/* ============================================
   SecureSign - Complete Style System
   Modern, Accessible, Professional Design
   ============================================ */

/* === CSS VARIABLES === */
:root {
    /* Primary Colors */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #8b9bef;
    --secondary: #764ba2;
    
    /* Status Colors */
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --info: #3b82f6;
    --info-dark: #2563eb;
    
    /* Neutral Colors with High Contrast */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Text Colors - High Contrast */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #4b5563;
    --text-light: #6b7280;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 15px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

strong, b {
    color: var(--text-primary);
    font-weight: 700;
}

small {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* === CONTAINER === */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 3rem;
}

.container-narrow {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* === HEADER === */
.main-header {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.logo i {
    font-size: 1.75rem;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text-primary);
    font-weight: 600;
}

.user-info i {
    font-size: 1.5rem;
    color: var(--primary);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--danger);
    color: white;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: var(--danger-dark);
}

/* === DASHBOARD === */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.dashboard-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0;
}

.dashboard-header p {
    color: var(--text-tertiary);
    font-weight: 600;
    margin: 0.25rem 0 0 0;
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
    border: 2px solid transparent;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-content h3 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
}

.stat-content p {
    margin: 0.25rem 0 0 0;
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    font-weight: 600;
}

/* === DASHBOARD CONTENT === */
.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.documents-section,
.requests-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.documents-section h2,
.requests-section h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.documents-section h2 i,
.requests-section h2 i {
    color: var(--primary);
}

/* === TABLES === */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.data-table thead th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
}

.data-table thead th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.data-table thead th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.data-table tbody tr {
    transition: var(--transition-fast);
    background: var(--bg-primary);
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table tbody td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-md);
}

.data-table tbody tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-md) 0;
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-pending {
    background: #fef3c7;
    color: #78350f;
}

.badge-sent {
    background: #dbeafe;
    color: #1e3a8a;
}

.badge-signed {
    background: #d1fae5;
    color: #064e3b;
}

.badge-expired {
    background: #fee2e2;
    color: #7f1d1d;
}

.badge-opened {
    background: #e0e7ff;
    color: #312e81;
}

.badge-cancelled {
    background: var(--gray-200);
    color: var(--gray-800);
}

/* === REQUEST LIST === */
.request-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.request-item {
    padding: 1.25rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: start;
    transition: var(--transition);
    background: var(--bg-primary);
}

.request-item:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
    transform: translateX(4px);
}

.request-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
}

.request-info p {
    margin: 0 0 0.375rem 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
}

.request-info small {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.request-status {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.request-status small {
    color: var(--text-tertiary);
    font-weight: 600;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--gray-300);
}

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-dark);
}

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

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: var(--transition-fast);
    text-decoration: none;
    border: 2px solid var(--gray-200);
    background: var(--bg-primary);
    margin: 0 0.25rem;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* === FORMS === */
.form-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-card h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.form-group label i {
    margin-right: 0.375rem;
    color: var(--primary);
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: var(--transition-fast);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* === ALERTS === */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border-left: 4px solid;
    font-weight: 500;
}

.alert i {
    font-size: 1.375rem;
    flex-shrink: 0;
}

.alert-info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e3a8a;
}

.alert-error {
    background: #fee2e2;
    border-color: #ef4444;
    color: #7f1d1d;
}

.alert-success {
    background: #d1fae5;
    border-color: #10b981;
    color: #064e3b;
}

.alert-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #78350f;
}

.alert strong {
    font-weight: 700;
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.page-header h1 {
    font-size: 1.875rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.page-header h1 i {
    color: var(--primary);
}

/* === DOCUMENT INFO === */
.document-info-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.document-info-card i {
    font-size: 3rem;
    color: var(--danger);
}

.document-info-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.document-info-card p {
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

/* === FILE UPLOAD === */
.file-upload-wrapper {
    position: relative;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-display {
    border: 3px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.file-upload-display:hover {
    border-color: var(--primary);
    background: var(--gray-100);
}

.file-upload-display i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
    display: block;
}

.file-upload-display p {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.file-upload-display small {
    color: var(--text-tertiary);
    font-weight: 500;
}

/* === SIGN PAGE === */
.sign-page {
    background: var(--bg-tertiary);
}

.sign-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 1.5rem;
}

.sign-header {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.sign-header i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.sign-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0;
}

.sign-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.document-header {
    padding: 1.75rem;
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.document-header i {
    font-size: 3rem;
    color: var(--danger);
}

.document-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.document-header p {
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.client-info {
    padding: 1.25rem 1.75rem;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--gray-200);
}

.client-info p {
    margin-bottom: 0.625rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.client-info p strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* === UTILITIES === */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

.bg-primary { background: var(--bg-primary) !important; }
.bg-secondary { background: var(--bg-secondary) !important; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

/* === RESPONSIVE === */
@media (max-width: 1400px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 1.5rem 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }
    
    .main-nav {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: row;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .data-table {
        font-size: 0.8125rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* === PRINT STYLES === */
@media print {
    .main-header,
    .btn,
    .form-actions,
    .nav-link {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .container {
        padding: 0;
    }
}
