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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(135deg, #1a5276, #2e86c1);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.3rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 5px;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background 0.3s;
    font-size: 0.9rem;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.2);
}

/* ===== PAGES ===== */
.page {
    display: none;
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.page.active {
    display: block;
}

/* ===== HERO SECTION ===== */
.hero {
    text-align: center;
    padding: 2rem 0;
    background: white;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.hero h2 {
    color: #1a5276;
    margin-bottom: 0.5rem;
}

.hero p {
    color: #666;
    font-size: 1.1rem;
}

/* ===== DOCUMENT CARDS ===== */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.document-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.document-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.document-card h3 {
    color: #1a5276;
    margin-bottom: 0.5rem;
}

.document-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s;
    margin: 5px;
}

.btn-primary {
    background: #2e86c1;
    color: white;
}

.btn-primary:hover {
    background: #1a5276;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #1e8449;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    display: block;
    width: 100%;
    margin: 10px 0;
}

/* ===== INFO SECTION ===== */
.info-section {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.info-section h3 {
    color: #1a5276;
    margin-bottom: 1rem;
}

.info-section ol {
    padding-left: 2rem;
}

.info-section li {
    margin-bottom: 0.5rem;
}

/* ===== SIGNATURES COUNT ===== */
.signatures-count {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.signatures-count h3 {
    color: #1a5276;
    margin-bottom: 1rem;
}

.count-grid {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.count-card {
    text-align: center;
}

.count-number {
    display: block;
    font-size: 3rem;
    font-weight: bold;
    color: #2e86c1;
}

.count-label {
    display: block;
    color: #666;
    font-size: 0.9rem;
}

/* ===== SIGN PAGE ===== */
.sign-page-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.document-viewer {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    max-height: 80vh;
    overflow-y: auto;
}

.document-viewer h2 {
    color: #1a5276;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

.document-content {
    line-height: 1.8;
}

.document-content h3 {
    color: #1a5276;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.document-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.document-content ul,
.document-content ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

/* ===== SIGNATURE FORM ===== */
.signature-form-section {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    position: sticky;
    top: 80px;
}

.signature-form-section h3 {
    color: #1a5276;
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #2e86c1;
}

/* ===== SIGNATURE PAD ===== */
.signature-pad-container {
    position: relative;
    margin-bottom: 0.5rem;
}

.signature-pad-container canvas {
    width: 100%;
    height: 200px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: crosshair;
    background: white;
    touch-action: none;
}

.signature-pad-container .clear-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
}

/* ===== SUCCESS MESSAGE ===== */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 1rem;
    text-align: center;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    text-align: center;
}

/* ===== SIGNATURES LIST ===== */
.signatures-list-section {
    margin-top: 2rem;
    border-top: 2px solid #eee;
    padding-top: 1rem;
}

.signatures-list-section h4 {
    color: #1a5276;
    margin-bottom: 1rem;
}

.signatures-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.signatures-list-item:last-child {
    border-bottom: none;
}

.signature-info {
    flex: 1;
}

.signature-name {
    font-weight: 500;
}

.signature-address {
    font-size: 0.85rem;
    color: #666;
}

.signature-thumb {
    width: 80px;
    height: 40px;
    border: 1px solid #ddd;
    background: white;
}

/* ===== ADMIN PAGE ===== */
.admin-container {
    max-width: 900px;
}

.admin-login {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.admin-login input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-right: 10px;
    font-size: 1rem;
}

.admin-panel {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #2e86c1;
    border-bottom-color: #2e86c1;
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-actions {
    margin: 1rem 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-signatures-list {
    margin-top: 1rem;
}

.admin-signature-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 10px;
}

.admin-signature-item .sig-number {
    font-weight: bold;
    color: #2e86c1;
    min-width: 40px;
}

.admin-signature-item .sig-info {
    flex: 1;
    margin-left: 15px;
}

.admin-signature-item .sig-image {
    width: 120px;
    height: 60px;
    border: 1px solid #ddd;
    background: white;
}

.admin-signature-item .sig-delete {
    margin-left: 15px;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5vh;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    padding: 2rem;
    position: relative;
    margin-bottom: 5vh;
}

.modal-large {
    max-width: 900px;
}

.modal-xlarge {
    max-width: 95%;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    z-index: 10;
}

.modal-close:hover {
    color: #333;
}

#modal-body {
    line-height: 1.8;
    max-height: 70vh;
    overflow-y: auto;
}

/* ===== PDF PREVIEW ===== */
.pdf-actions {
    margin-bottom: 1rem;
    text-align: center;
}

.pdf-preview {
    width: 100%;
    flex: 1;
    border: none;
    border-radius: 5px;
}

/* ===== FOOTER ===== */
.footer {
    background: #1a5276;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 10px;
    }

    .nav-links {
        justify-content: center;
    }

    .documents-grid {
        grid-template-columns: 1fr;
    }

    .sign-page-container {
        grid-template-columns: 1fr;
    }

    .signature-form-section {
        position: static;
    }

    .count-grid {
        flex-direction: column;
        gap: 1.5rem;
    }

    .admin-signature-item {
        flex-direction: column;
        text-align: center;
    }

    .admin-signature-item .sig-info {
        margin-left: 0;
        margin-top: 10px;
    }

    .admin-signature-item .sig-delete {
        margin-left: 0;
        margin-top: 10px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar, .footer, .signature-form-section, .admin-actions, .btn {
        display: none !important;
    }

    .page {
        display: block !important;
    }

    body {
        background: white;
    }
}

/* ===== DOCUMENT PRINT FORMAT ===== */
.print-document {
    font-family: 'Times New Roman', serif;
    line-height: 1.8;
    padding: 2cm;
}

.print-document h1 {
    text-align: center;
    font-size: 16pt;
    margin-bottom: 20px;
}

.print-document h2 {
    font-size: 14pt;
    margin-top: 20px;
    margin-bottom: 10px;
}

.print-document table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.print-document th,
.print-document td {
    border: 1px solid #000;
    padding: 8px;
    text-align: left;
}

.print-document th {
    background-color: #f0f0f0;
    font-weight: bold;
}

.print-document .signature-cell {
    height: 60px;
    vertical-align: top;
}