/* ============================================
   SignDocs - Professional Document Signing
   Complete Stylesheet
   ============================================ */

/* --- CSS Variables / Design Tokens --- */
:root {
    /* Primary palette */
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #eef0ff;
    --primary-gradient: linear-gradient(135deg, #4361ee, #7209b7);
    
    /* Semantic colors */
    --success: #06d6a0;
    --success-dark: #05b88a;
    --success-light: #e6f9f2;
    --warning: #ffd166;
    --warning-dark: #f0c050;
    --danger: #ef476f;
    --danger-light: #fde8ed;
    --info: #118ab2;
    
    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* --- Base Styles --- */
body {
    font-family: var(--font-family);
    background: 
        radial-gradient(ellipse at 0% 0%, rgba(67, 97, 238, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(114, 9, 183, 0.03) 0%, transparent 50%),
        var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Navigation --- */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 0;
}

.navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.navbar .navbar-brand .brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    margin-right: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.navbar .nav-link {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-600);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.navbar .nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.navbar .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

.navbar .nav-link i {
    margin-right: 0.4rem;
}

.nav-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: var(--shadow-sm);
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.page-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* --- Cards --- */
.card {
    border-radius: var(--radius-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    font-weight: 600;
}

.card-footer {
    border-top: 1px solid var(--gray-200);
    border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
}

/* --- Document Cards --- */
.document-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.document-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg) !important;
}

.document-card .card-img-top {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0) !important;
}

.document-card .card-title {
    font-size: 0.9rem;
}

/* --- Stat Cards --- */
.stat-card {
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md) !important;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

/* --- Status Badges --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.status-badge.signed {
    background: var(--success-light);
    color: var(--success-dark);
    border: 1px solid rgba(6, 214, 160, 0.3);
}

.status-badge.pending {
    background: #fff8e1;
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.expired {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 71, 111, 0.3);
}

/* --- Buttons --- */
.btn {
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #5e0fa8);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #05b88a);
    border: none;
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-dark), #049a75);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #d63d5f);
    border: none;
}

.btn-outline-secondary {
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    background: white;
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

.btn-outline-danger {
    border: 1px solid rgba(239, 71, 111, 0.3);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-outline-danger.active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
}

/* --- Form Controls --- */
.form-control {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.form-text {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 0.3rem;
}

/* OTP Input */
.otp-input {
    font-size: 1.75rem !important;
    letter-spacing: 0.5em;
    text-align: center;
    font-weight: 700;
    padding: 0.75rem;
    border-radius: var(--radius-md);
}

/* --- Alerts --- */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-danger {
    background: var(--danger-light);
    color: #9b1c3a;
}

.alert-warning {
    background: #fff8e1;
    color: #92400e;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
}

/* --- Modal --- */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* --- Profile --- */
.profile-header {
    background: var(--primary-gradient);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1.75rem;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

/* --- Empty State --- */
.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    background: var(--gray-100);
    border-radius: 50%;
    font-size: 2.5rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

/* --- Footer --- */
footer {
    margin-top: auto;
}

footer hr {
    opacity: 0.15;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.4s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

/* Stagger children animations */
.stagger-children > * {
    animation: fadeInUp 0.5s ease-out both;
}

.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.9s; }

/* --- Gradient Utilities --- */
.bg-gradient-primary {
    background: var(--primary-gradient) !important;
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--success), #05b88a) !important;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, var(--warning), #f0c050) !important;
}

.bg-gradient-danger {
    background: linear-gradient(135deg, var(--danger), #d63d5f) !important;
}

/* --- Card Accent --- */
.card-accent-success {
    border-top: 4px solid var(--success) !important;
}

.card-accent-primary {
    border-top: 4px solid var(--primary) !important;
}

/* --- Page Navigation Buttons --- */
.page-nav-btn {
    min-width: 100px;
}

/* --- Placement Overlay --- */
.placement-overlay {
    transition: opacity 0.2s ease;
}

.placement-overlay:hover {
    opacity: 1 !important;
}

.overlay-img {
    background: white;
    transition: all 0.2s ease;
}

.overlay-img:hover {
    opacity: 1 !important;
    box-shadow: var(--shadow-md) !important;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* --- Responsive Tweaks --- */
@media (max-width: 576px) {
    .page-header {
        padding: 1rem;
    }
    
    .stat-card .card-body {
        padding: 0.75rem !important;
    }
    
    .profile-header {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .navbar .navbar-brand {
        font-size: 1.1rem;
    }
}

/* --- Selection --- */
::selection {
    background: rgba(67, 97, 238, 0.2);
    color: var(--gray-900);
}

/* --- Focus Ring --- */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Print Styles --- */
@media print {
    .navbar, footer, .btn, .page-nav-btn, .page-header-icon {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
