/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #000000;
    --primary-dark: #1a1a1a;
    --secondary-color: #333333;
    --success-color: #000000;
    --error-color: #000000;
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --card-hover: #f5f5f5;
    --text-color: #000000;
    --text-light: #666666;
    --border-color: #000000;
    --shadow: 4px 4px 0px rgba(0, 0, 0, 1);
    --shadow-lg: 8px 8px 0px rgba(0, 0, 0, 1);
    --shadow-colored: 6px 6px 0px rgba(0, 0, 0, 1);
}

body {
    font-family: 'Courier New', Courier, monospace;
    background: #ffffff;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    display: flex;
    flex-direction: column;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(0deg, transparent 0px, transparent 8px, rgba(0,0,0,0.02) 8px, rgba(0,0,0,0.02) 16px),
        repeating-linear-gradient(90deg, transparent 0px, transparent 8px, rgba(0,0,0,0.02) 8px, rgba(0,0,0,0.02) 16px);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
    flex: 1;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0;
    color: #000000;
    background: #ffffff;
    border: 4px solid #000000;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 1);
    margin-bottom: 30px;
}

.header h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    font-weight: 900;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 4px;
    animation: pixelGlitch 0.6s ease-out;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    color: #333333;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.back-link {
    color: #000000;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    border: 3px solid #000000;
    padding: 8px 16px;
    background: #ffffff;
    transition: all 0.2s;
}

.back-link:hover {
    background: #000000;
    color: #ffffff;
    transform: translate(2px, 2px);
}

/* Main Content */
.main-content {
    margin: 40px 0;
}

/* Card */
.card {
    background: #ffffff;
    border: 4px solid #000000;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    animation: pixelSlideUp 0.5s ease-out;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(90deg, #000000 0px, #000000 8px, transparent 8px, transparent 16px);
}

.card h2 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 4px solid #000000;
    padding-bottom: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    text-decoration: none;
    font-weight: 900;
    transition: all 0.1s;
    cursor: pointer;
    border: 4px solid #000000;
    font-size: 1rem;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Courier New', Courier, monospace;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0,0,0,0.05) 2px, rgba(0,0,0,0.05) 4px);
    pointer-events: none;
}

.btn:active {
    transform: translate(4px, 4px);
    box-shadow: none !important;
}

.btn-primary {
    background: #000000;
    color: #ffffff;
    box-shadow: var(--shadow-colored);
}

.btn-primary:hover {
    background: #ffffff;
    color: #000000;
}

.btn-secondary {
    background: #ffffff;
    color: #000000;
    border: 4px solid #000000;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    background: #f0f0f0;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature {
    background: #ffffff;
    padding: 35px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    border: 4px solid #000000;
    position: relative;
}

.feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, transparent 0px, transparent 4px, rgba(0,0,0,0.02) 4px, rgba(0,0,0,0.02) 8px);
    pointer-events: none;
}

.feature::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(90deg, #000000 0px, #000000 8px, transparent 8px, transparent 16px);
}

.feature:hover {
    transform: translate(-4px, -4px);
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 1);
    background: #f5f5f5;
}

.feature-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    display: inline-block;
    transition: transform 0.2s;
    font-weight: 900;
    color: #000000;
    font-family: 'Courier New', Courier, monospace;
}

.feature:hover .feature-icon {
    transform: scale(1.1);
    animation: pixelBounce 0.4s;
}

.feature h3 {
    margin-bottom: 10px;
    color: #000000;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Form */
.form-card {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 3px solid #000000;
    font-size: 1rem;
    transition: all 0.1s;
    background: #ffffff;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #000000;
    background: #f9f9f9;
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 1);
    transform: translate(-2px, -2px);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Messages */
.error-message {
    background: #ffffff;
    color: #000000;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 4px solid #000000;
    font-weight: 900;
    animation: pixelShake 0.3s ease-out;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

@keyframes pixelShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes pixelSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pixelGlitch {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(2px, -2px);
    }
    60% {
        transform: translate(-2px, -2px);
    }
    80% {
        transform: translate(2px, 2px);
    }
}

@keyframes pixelBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.success-message {
    background: #ffffff;
    color: #000000;
    padding: 12px;
    margin-bottom: 20px;
    border: 4px solid #000000;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: var(--text-light);
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    background: #ffffff;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 4px solid #000000;
    animation: pixelSlideUp 0.5s ease-out;
    position: relative;
}

.toolbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(90deg, #000000 0px, #000000 8px, transparent 8px, transparent 16px);
}

.search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.search-box input {
    flex: 1;
    padding: 14px 20px;
    border: 3px solid #000000;
    font-size: 1rem;
    background: #ffffff;
    transition: all 0.1s;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

.search-box input:focus {
    outline: none;
    border-color: #000000;
    background: #f9f9f9;
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 1);
    transform: translate(-2px, -2px);
}

/* Films Grid */
.films-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.film-card {
    background: #ffffff;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    cursor: pointer;
    border: 4px solid #000000;
    position: relative;
}

.film-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg, transparent 0px, transparent 8px, rgba(0,0,0,0.02) 8px, rgba(0,0,0,0.02) 16px);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
    pointer-events: none;
}

.film-card:hover::before {
    opacity: 1;
}

.film-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 1);
}

.film-poster {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: repeating-linear-gradient(45deg, #e0e0e0, #e0e0e0 10px, #d0d0d0 10px, #d0d0d0 20px);
    transition: transform 0.2s;
    border-bottom: 4px solid #000000;
}

.film-card:hover .film-poster {
    transform: scale(1.02);
}

.film-info {
    padding: 20px;
    position: relative;
    z-index: 2;
    background: #ffffff;
}

.film-title {
    font-weight: 900;
    margin-bottom: 8px;
    color: #000000;
    font-size: 1.05rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.film-year {
    color: #333333;
    font-size: 0.9rem;
    font-weight: 700;
}

.film-rate {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    color: #000000;
    font-weight: 900;
    border: 2px solid #000000;
    padding: 4px 8px;
    display: inline-flex;
    background: #ffffff;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    padding: 30px;
    background: #ffffff;
    border: 4px solid #000000;
    box-shadow: var(--shadow);
}

.page-info {
    font-weight: 900;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #000000;
    padding: 0 20px;
}

.pagination .btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: #ffffff;
    box-shadow: var(--shadow);
    border: 4px solid #000000;
    animation: pixelSlideUp 0.5s ease-out;
    position: relative;
}

.empty-state::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(90deg, #000000 0px, #000000 8px, transparent 8px, transparent 16px);
}

.empty-state p {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: #000000;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.empty-state .btn {
    margin-top: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    background-image: repeating-linear-gradient(0deg, transparent 0px, transparent 4px, rgba(0,0,0,0.1) 4px, rgba(0,0,0,0.1) 8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    padding: 40px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 4px solid #000000;
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 1);
    animation: pixelSlideUp 0.4s ease-out;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(90deg, #000000 0px, #000000 8px, transparent 8px, transparent 16px);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #000000;
    transition: all 0.2s;
    font-weight: 900;
    background: #ffffff;
    border: 3px solid #000000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-btn:hover {
    background: #000000;
    color: #ffffff;
    transform: rotate(90deg);
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: #000000;
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
    border-top: 4px solid #000000;
    margin-top: auto;
    background: #ffffff;
    width: 100%;
    box-shadow: 0 -4px 0px rgba(0, 0, 0, 0.1);
}

/* User info badge */
#user-info {
    background: #ffffff;
    padding: 10px 20px;
    border: 3px solid #000000;
    font-weight: 900;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

#user-info:hover {
    background: #f0f0f0;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 1);
}

/* Logout button in toolbar */
#logout-btn {
    padding: 10px 24px;
    font-size: 0.95rem;
    background: #ffffff;
    color: #000000;
    border: 3px solid #000000;
    font-weight: 900;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

#logout-btn:hover {
    background: #000000;
    color: #ffffff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 1);
}

/* Delete button style */
.btn-delete {
    background: #000000;
    color: #ffffff;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
    font-weight: 900;
    border: 3px solid #000000;
}

.btn-delete:hover {
    background: #ffffff;
    color: #000000;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 1);
}

/* Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    background-image: repeating-linear-gradient(0deg, transparent 0px, transparent 4px, rgba(0,0,0,0.1) 4px, rgba(0,0,0,0.1) 8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: pixelFadeIn 0.3s ease-out;
}

.confirm-content {
    background: #ffffff;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    border: 4px solid #000000;
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 1);
    animation: pixelPopIn 0.3s ease-out;
    text-align: center;
    position: relative;
}

.confirm-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(90deg, #000000 0px, #000000 8px, transparent 8px, transparent 16px);
}

.confirm-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pixelBounce 0.5s ease-out;
    font-weight: 900;
    color: #000000;
    font-family: 'Courier New', Courier, monospace;
}

.confirm-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #000000;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.confirm-message {
    font-size: 1.05rem;
    color: #333333;
    margin-bottom: 30px;
    line-height: 1.6;
    font-weight: 700;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-buttons .btn {
    flex: 1;
    max-width: 180px;
}

@keyframes pixelFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pixelPopIn {
    from {
        opacity: 0;
        transform: scale(0.8) translate(20px, 20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translate(0, 0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .toolbar {
        flex-direction: column;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .films-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

