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

:root {
    --primary-color: #2563eb;
    --secondary-color: #1d4ed8;
    --accent-color: #3b82f6;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --shadow-color: rgba(37, 99, 235, 0.2);
    --gradient-start: #2563eb;
    --gradient-end: #1d4ed8;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(120deg, #f8fafc 0%, #f0abfc 100%);
    animation: bgGradientMove 10s ease-in-out infinite alternate;
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

/* Layout */
.container {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

.section {
    position: absolute;
    width: 100%;
    min-height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-color: var(--background-color);
    padding: 2rem 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateY(20px);
}

.section.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
    animation: swipeInSection 0.8s cubic-bezier(.68,-0.55,.27,1.55);
}

/* Welcome Screen */
.welcome-screen {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    pointer-events: all;
    position: relative;
    z-index: 10;
}

.profile-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.8s ease-out;
}

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

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.profile-pic {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid transparent;
    background: linear-gradient(135deg, #f472b6, #60a5fa, #34d399, #f472b6) border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 20px #f472b6aa, 0 0 40px #60a5fa55;
    transition: border 0.5s, box-shadow 0.5s;
    cursor: pointer;
    object-fit: cover;
}

.profile-pic:hover {
    border: 4px solid transparent;
    background: linear-gradient(270deg, #f472b6, #60a5fa, #34d399, #f472b6) border-box;
    box-shadow: 0 0 60px #f472b6cc, 0 0 80px #60a5fa99;
    animation: rainbowBorder 2s linear infinite;
}

@keyframes rainbowBorder {
    0% { filter: hue-rotate(0deg);}
    100% { filter: hue-rotate(360deg);}
}

.profile-title h1 {
    font-size: 2.5em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
    line-height: 1.2;
}

.tagline {
    font-size: 1.2em;
    color: var(--text-color);
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Info Tiles */
.info-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1rem;
    width: 100%;
}

.tile {
    animation: tileAppear 0.6s cubic-bezier(.68,-0.55,.27,1.55) forwards;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    animation-delay: calc(var(--tile-index, 0) * 0.1s);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px 0 #a5b4fc33, 0 2px 8px #f472b633;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 15px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

/* Remove the :after pseudo-element as it's not needed */
@media (prefers-reduced-motion: reduce) {
    .tile {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}

/* Add hover effects */
.tile:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 32px #a5fcdb66, 0 2px 8px #f472b666;
    background: rgba(255,255,255,0.95);
}

/* Add styles for tile content */
.tile i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.tile h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.tile p {
    margin: 0.5rem 0;
    color: var(--text-color);
    opacity: 0.9;
}

.tile::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 15px;
    pointer-events: none; /* Ensure overlay never blocks pointer events */
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 0;
}

.tile:hover::before {
    opacity: 0; /* No overlay on hover */
}

/* Add animated border and shadow on hover */
.tile:hover {
    border: 2px solid #60a5fa;
    box-shadow: 0 8px 32px #f472b6cc, 0 2px 16px #60a5fa99;
    background: rgba(240, 171, 252, 0.95);
    transform: translateY(-8px) scale(1.04) rotate(-1deg);
    transition: all 0.3s cubic-bezier(.68,-0.55,.27,1.55);
}

/* Add ripple effect on click */
.tile:active::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 0; height: 0;
    background: radial-gradient(circle, #60a5fa55 10%, transparent 70%);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    animation: ripple 0.5s linear;
    z-index: 1;
    pointer-events: none;
}
@keyframes ripple {
    to {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* Animate icon and title on hover */
.tile i, .tile h3 {
    transition: transform 0.4s, filter 0.4s, color 0.4s;
}

.tile:hover i {
    transform: scale(1.25) rotate(-10deg);
    filter: drop-shadow(0 4px 16px #f472b6);
    color: #f472b6;
}

.tile:hover h3 {
    color: #60a5fa;
    transform: scale(1.1);
}

.tile p {
    margin: 0.3rem 0;
    color: var(--secondary-color);
    line-height: 1.5;
}

.tile:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 32px #a5b4fc66, 0 2px 8px #f472b666;
    animation: swipeUp 0.6s cubic-bezier(.68,-0.55,.27,1.55);
    z-index: 2;
}

/* Swipe-in animation for info-tiles */
@keyframes swipeInTiles {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.95);
    }
    60% {
        opacity: 1;
        transform: translateY(-10px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    color: var(--primary-color);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f472b6 0%, #60a5fa 100%);
    color: #fff;
    box-shadow: 0 2px 8px #a5b4fc33;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(.68,-0.55,.27,1.55);
}

.social-links a:hover {
    background: linear-gradient(135deg, #34d399 0%, #f472b6 100%);
    color: #fff;
    box-shadow: 0 4px 24px #f472b6cc, 0 2px 8px #60a5fa99;
    border: 2px solid #34d399;
    transform: scale(1.18) translateY(-8px) rotate(-8deg);
}

/* Login Section */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    width: 100%;
}

.login-content {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 450px;
    width: 100%;
    margin: 2rem;
}

.login-content h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.login-form {
    margin-top: 1.5rem;
}

.animated-input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.animated-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.animated-button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.animated-button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.animated-button:active {
    transform: translateY(0);
}

/* Document Management Section */
#mainContent {
    padding: 2rem 1rem;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-pic {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.user-details h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-color);
}

.user-details p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

.logout-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #ef4444;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

.actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.upload-section, .documents-section {
    background: linear-gradient(120deg, #f0abfc 0%, #a5b4fc 100%);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px #a5b4fc33, 0 2px 8px #f472b633;
}

.upload-section h2, .documents-section h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.upload-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* Modal Styles */
#previewModal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30,41,59,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    opacity: 1;
    transition: opacity 0.3s;
}
#previewModal.hidden {
    display: none !important;
}
#previewModal .modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    min-width: 320px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    position: relative;
}
#previewModal .close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #e5e7eb;
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    font-size: 1.5rem;
    color: #374151;
    cursor: pointer;
    transition: background 0.2s;
}
#previewModal .close-modal:hover {
    background: #f87171;
    color: #fff;
}

/* Spinner Styles */
#globalSpinner {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30000;
}
#globalSpinner.hidden {
    display: none !important;
}
.spinner {
    border: 6px solid #e5e7eb;
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Accessibility: Focus outline for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes bgGradientMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.show {
    display: block !important;
    animation: fadeInScale 0.5s ease forwards;
}

.fade-in {
    animation: fadeInScale 0.5s ease forwards;
}

.slide-in {
    animation: slideIn 0.5s ease forwards;
}
