/*
 * CogniSign -- Document Signing Platform
 * Main Stylesheet
 *
 * Design language: Clean, professional, trust-building.
 * Primary: Steel Blue (#2B6CB0)
 * Background: Warm white (#FAFBFC)
 * Typography: System font stack
 */

/* -- Reset & Base -- */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #FAFBFC;
    color: #1a1a1a;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* -- Header -- */

.site-header {
    background-color: #ffffff;
    border-bottom: 2px solid #2B6CB0;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background-color: #2B6CB0;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
}

.header-company {
    font-size: 14px;
    color: #666666;
}

/* -- Main Content -- */

.site-main {
    flex: 1;
    padding: 32px 0;
}

/* -- Footer -- */

.site-footer {
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 24px 0;
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    font-size: 13px;
    color: #888888;
    margin-bottom: 4px;
}

/* -- Buttons -- */

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background-color: #2B6CB0;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #2558a0;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

/* -- Signing Page -- */

.signing-page {
    max-width: 800px;
    margin: 0 auto;
}

.signing-header {
    margin-bottom: 28px;
}

.signing-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #555555;
}

.meta-item strong {
    color: #333333;
}

/* Signatory status bar */

.signatory-status-bar {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 28px;
}

.signatory-status-bar h3 {
    font-size: 14px;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.signatory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.signatory-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.signatory-chip.signed {
    background-color: #f0fff4;
    border-color: #c6f6d5;
}

.signatory-chip.current {
    background-color: #ebf8ff;
    border-color: #bee3f8;
}

.signatory-chip.pending {
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

.chip-icon {
    font-size: 14px;
}

.signatory-chip.signed .chip-icon { color: #38a169; }
.signatory-chip.current .chip-icon { color: #2B6CB0; }
.signatory-chip.pending .chip-icon { color: #a0aec0; }

.chip-name {
    font-weight: 600;
    color: #1a1a1a;
}

.chip-role {
    color: #888888;
    font-size: 12px;
}

/* Document viewer */

.document-viewer {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 28px;
    overflow: hidden;
}

.document-viewer h2 {
    font-size: 16px;
    padding: 16px 24px;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #333333;
}

.document-content {
    padding: 24px;
    font-size: 15px;
    line-height: 1.7;
}

.document-content h1 { font-size: 22px; color: #2B6CB0; margin: 24px 0 12px; }
.document-content h2 { font-size: 18px; color: #333; margin: 20px 0 10px; border-bottom: 1px solid #eee; padding-bottom: 6px; }
.document-content h3 { font-size: 16px; color: #444; margin: 16px 0 8px; }
.document-content p { margin-bottom: 12px; }
.document-content ul, .document-content ol { margin-bottom: 12px; padding-left: 24px; }
.document-content li { margin-bottom: 6px; }

/* Signing action */

.signing-action {
    background-color: #ffffff;
    border: 2px solid #2B6CB0;
    border-radius: 8px;
    padding: 28px;
    margin-bottom: 28px;
}

.signing-action h2 {
    font-size: 20px;
    color: #2B6CB0;
    margin-bottom: 12px;
}

.signing-identity {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0 24px;
}

.identity-row {
    display: flex;
    gap: 12px;
    padding: 4px 0;
}

.identity-label {
    color: #666666;
    min-width: 80px;
    font-size: 14px;
}

.identity-value {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 14px;
}

.signing-step {
    margin-top: 20px;
}

/* Code input */

.code-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 16px 0;
}

.code-input {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    width: 200px;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    transition: border-color 0.15s;
}

.code-input:focus {
    outline: none;
    border-color: #2B6CB0;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

.code-hint {
    font-size: 13px;
    color: #666666;
    margin-top: 8px;
}

.code-resend {
    font-size: 13px;
    color: #888888;
    margin-top: 12px;
}

.code-resend a {
    color: #2B6CB0;
    text-decoration: none;
    font-weight: 600;
}

.code-resend a:hover {
    text-decoration: underline;
}

/* Success message */

.success-message {
    text-align: center;
    padding: 20px;
}

.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: #f0fff4;
    color: #38a169;
    border-radius: 50%;
    font-size: 24px;
    margin-bottom: 12px;
}

.success-icon.large {
    width: 72px;
    height: 72px;
    font-size: 36px;
    margin-bottom: 20px;
}

.success-message h3 {
    font-size: 18px;
    color: #1a1a1a;
    margin-bottom: 8px;
}

/* Error message */

.error-message {
    background-color: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 16px;
}

/* -- Complete Page -- */

.complete-page {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
}

.success-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.success-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.complete-details {
    text-align: left;
    background-color: #f8fafc;
    border-radius: 6px;
    padding: 16px 20px;
    margin: 24px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.detail-label {
    color: #666666;
}

.detail-value {
    font-weight: 600;
    color: #1a1a1a;
}

.complete-note {
    font-size: 14px;
    color: #666666;
    margin-top: 20px;
}

/* -- Admin Page -- */

.admin-page h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* Stats grid */

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

.stat-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #2B6CB0;
}

.stat-label {
    font-size: 13px;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.stat-pending .stat-number { color: #d69e2e; }
.stat-partial .stat-number { color: #dd6b20; }
.stat-complete .stat-number { color: #38a169; }

/* Admin sections */

.admin-section {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.admin-section h2 {
    font-size: 18px;
    color: #333333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* Admin forms */

.admin-form .form-group {
    margin-bottom: 16px;
}

.admin-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 6px;
}

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="tel"],
.admin-form input[type="number"],
.admin-form textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.admin-form input:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: #2B6CB0;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.admin-form textarea {
    resize: vertical;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
}

.signatory-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 0.7fr;
    gap: 8px;
    margin-bottom: 8px;
}

.signatory-form-row input {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.form-result {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

.form-result.success {
    background-color: #f0fff4;
    border: 1px solid #c6f6d5;
    color: #276749;
}

.form-result.error {
    background-color: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
}

/* Admin tables */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.admin-table th {
    font-weight: 600;
    color: #555555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background-color: #f8fafc;
}

.admin-table code {
    font-size: 12px;
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Signing request cards */

.sr-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    background-color: #fafbfc;
}

.sr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sr-header h3 {
    font-size: 16px;
    color: #1a1a1a;
}

.sr-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #666666;
    margin-bottom: 16px;
}

.sr-meta code {
    font-size: 12px;
    background-color: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
}

/* Progress bar */

.sr-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #38a169;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: #555555;
    font-weight: 600;
    white-space: nowrap;
}

/* Signatory table within SR cards */

.signatory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 12px;
}

.signatory-table th,
.signatory-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.signatory-table th {
    font-weight: 600;
    color: #666666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.signing-link {
    color: #2B6CB0;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}

.signing-link:hover {
    text-decoration: underline;
}

.sr-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Status badges */

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-draft     { background: #f1f5f9; color: #64748b; }
.status-active    { background: #ebf8ff; color: #2B6CB0; }
.status-pending   { background: #fefcbf; color: #975a16; }
.status-sent      { background: #ebf8ff; color: #2B6CB0; }
.status-viewed    { background: #e9d8fd; color: #6b46c1; }
.status-partial   { background: #feebc8; color: #c05621; }
.status-signed    { background: #c6f6d5; color: #276749; }
.status-complete  { background: #c6f6d5; color: #276749; }
.status-expired   { background: #fed7d7; color: #c53030; }
.status-cancelled { background: #e2e8f0; color: #4a5568; }
.status-declined  { background: #fed7d7; color: #c53030; }
.status-archived  { background: #e2e8f0; color: #718096; }

/* Empty states */

.empty-state {
    text-align: center;
    padding: 32px;
    color: #888888;
    font-size: 15px;
}

/* -- Responsive -- */

@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .doc-meta { flex-direction: column; gap: 8px; }
    .signatory-form-row { grid-template-columns: 1fr; }
    .code-input-group { flex-direction: column; }
    .code-input { width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .sr-meta { flex-direction: column; gap: 6px; }
}
