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

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --light: #f3f4f6;
    --dark: #1f2937;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header i {
    font-size: 48px;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    opacity: 0.9;
    font-size: 14px;
}

.login-form {
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
    font-size: 14px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

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

.login-footer {
    padding: 20px 30px;
    background: var(--light);
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

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

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 16px;
    transition: color 0.3s;
}

.btn-icon:hover {
    color: var(--primary-dark);
}

/* Header */
.main-header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    font-size: 28px;
}

.main-nav {
    display: flex;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark);
}

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

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--danger);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.3s;
}

.btn-logout:hover {
    opacity: 0.9;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-header h1 {
    font-size: 32px;
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 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: 32px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 5px;
}

.stat-content p {
    color: #6b7280;
    font-size: 14px;
}

/* Dashboard Content */
.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.documents-section,
.requests-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.documents-section h2,
.requests-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.data-table thead {
    background: var(--light);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

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

.badge-opened {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-signed {
    background: #d1fae5;
    color: #065f46;
}

.badge-expired {
    background: #fee2e2;
    color: #991b1b;
}

/* Request List */
.request-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.request-item {
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.request-info h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.request-info p {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 3px;
}

.request-info small {
    font-size: 12px;
    color: #9ca3af;
}

.request-status {
    text-align: right;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Form Card */
.form-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.form-card h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

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

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

/* 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: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
}

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

.file-upload-display i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
    display: block;
}

.file-upload-display p {
    font-size: 16px;
    color: var(--dark);
    margin-bottom: 5px;
}

.file-upload-display small {
    color: #6b7280;
}

/* Document Info Card */
.document-info-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.document-info-card i {
    font-size: 48px;
}

.document-info-card h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.document-info-card p {
    color: #6b7280;
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert i {
    font-size: 20px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

/* Sign Page */
.sign-page {
    background: var(--light);
}

.sign-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
}

.sign-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.sign-header i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
    display: block;
}

.sign-header h1 {
    font-size: 28px;
    color: var(--dark);
}

.sign-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.document-header {
    padding: 25px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
}

.document-header i {
    font-size: 48px;
}

.document-header h2 {
    font-size: 22px;
    margin-bottom: 5px;
}

.document-header p {
    color: #6b7280;
    font-size: 14px;
}

.client-info {
    padding: 20px 25px;
    background: var(--light);
    border-bottom: 2px solid var(--border);
}

.client-info p {
    margin-bottom: 8px;
    font-size: 14px;
}

.document-viewer {
    padding: 25px;
    background: #f9fafb;
}

.document-viewer iframe {
    border: 2px solid var(--border);
    border-radius: 8px;
}

.signature-section {
    padding: 30px;
}

.signature-section h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.signature-section p {
    color: #6b7280;
    margin-bottom: 20px;
}

#signatureCanvas {
    display: block;
    margin: 0 auto 20px;
    max-width: 100%;
}

.signature-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.signed-message {
    padding: 40px;
    text-align: center;
}

.signed-message i {
    font-size: 64px;
    color: var(--success);
    margin-bottom: 20px;
    display: block;
}

.signed-message h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

/* Utilities */
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }
    
    .main-nav {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
    }
    
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    #signatureCanvas {
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}
