/* ========== ЕРӨНХИЙ ЗАГВАР ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f5f5f5;
    line-height: 1.6;
}

/* Навигацийн меню */
.navbar {
    background-color: #003366;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.navbar-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background 0.3s;
    font-size: 15px;
}

.navbar-menu a:hover {
    background-color: #004d99;
}

.navbar-menu a.active {
    background-color: #004d99;
    font-weight: bold;
}

/* Үндсэн бүтэц */
.container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    padding: 25px;
    border-radius: 8px;
}

.page-title {
    text-align: center;
    color: #003366;
    font-size: 24px;
    margin: 0 0 25px 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #003366;
    font-weight: bold;
}

/* Ажлын урсгалын алхмууд */
.workflow-steps {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 20px 0;
    padding: 12px 10px 4px 10px;
    border-bottom: 1px solid #e0e0e0;
}

.workflow-step {
    flex: 1;
    text-align: center;
    position: relative;
    color: #888;
    font-size: 13px;
}

.workflow-step::after {
    content: "";
    position: absolute;
    top: 20px;
    right: -5px;
    width: 10px;
    height: 2px;
    background-color: #d0d0d0;
}

.workflow-step:last-child::after {
    display: none;
}

.workflow-step-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #cccccc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 5px auto;
    background-color: #f5f5f5;
    font-size: 13px;
    font-weight: 600;
}

.workflow-step-label {
    line-height: 1.3;
}

.workflow-step.active {
    color: #003366;
    font-weight: 600;
}

.workflow-step.active .workflow-step-number {
    background-color: #003366;
    color: #ffffff;
    border-color: #003366;
}

/* Нүүр хуудсын 3 том сонголт */
.main-choices-section {
    margin-bottom: 40px;
}

.main-choices {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px 25px;
}

.main-choice-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #003366 0%, #004d99 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,51,102,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.main-choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,51,102,0.4);
    color: white;
}

.main-choice-icon {
    font-size: 32px;
}

.main-choice-text {
    flex: 1;
}

/* Section */
.section {
    margin-bottom: 35px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.section-header {
    background-color: #003366;
    color: white;
    padding: 12px 20px;
    font-size: 18px;
    font-weight: bold;
}

.section-header h2 {
    font-size: 18px;
    margin: 0;
}

/* Form table */
.form-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.form-table tr {
    border-bottom: 1px solid #eee;
}

.form-table td {
    padding: 12px 10px;
    vertical-align: top;
}

.label-cell {
    width: 200px;
    font-weight: 600;
    color: #333;
    background-color: #f9f9f9;
    border-right: 1px solid #ddd;
}

.input-cell {
    padding: 8px 10px;
}

.field-error {
    color: #d9534f;
    font-size: 12px;
    margin-top: 4px;
}

.input-error {
    border-color: #d9534f !important;
    box-shadow: 0 0 3px rgba(217,83,79,0.6);
}

input[type="text"],
input[type="date"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    border-color: #003366;
    outline: none;
    box-shadow: 0 0 5px rgba(0,51,102,0.3);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.button-group {
    padding: 15px 20px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    background-color: #003366;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s;
    min-width: 80px;
}

.btn:hover {
    background-color: #002244;
}

.btn-small {
    padding: 6px 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.btn-small:hover {
    background-color: #5a6268;
}

/* Preview box */
.preview-box {
    padding: 25px;
    background-color: #fff;
    border: 2px dashed #003366;
    margin: 15px;
    font-family: 'Times New Roman', serif;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
    font-size: 14px;
}

.preview-box h3 {
    text-align: center;
    margin: 20px 0;
    font-size: 18px;
    font-weight: bold;
    text-decoration: underline;
}

.preview-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 10px;
    border-top: 2px solid #000;
    font-weight: bold;
}

/* PPD style document layout */
.ppd-doc {
    max-width: 820px;
    margin: 0 auto;
    padding: 28px 34px 40px;
    border: 1px solid #d5dbe3;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 27, 56, 0.08);
    color: #0f172a;
}

.ppd-head {
    text-align: center;
    padding-bottom: 14px;
    border-bottom: 2px solid #123d73;
    margin-bottom: 16px;
}

.ppd-head-top {
    font-size: 12px;
    letter-spacing: 0.6px;
    color: #2a4a74;
    text-transform: uppercase;
}

.ppd-head-main {
    margin-top: 8px;
    font-size: 27px;
    line-height: 1.2;
    font-weight: 700;
    text-transform: uppercase;
}

.ppd-meta {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    font-size: 15px;
    margin: 10px 0 18px;
}

.ppd-meta-center {
    text-align: center;
    font-weight: 700;
}

.ppd-subtitle {
    text-align: center;
    margin: 16px auto 20px;
    max-width: 85%;
    font-size: 22px;
    line-height: 1.35;
    font-weight: 700;
    text-decoration: underline;
}

.ppd-body {
    min-height: 220px;
    white-space: pre-wrap;
    font-size: 17px;
    line-height: 1.85;
}

.ppd-sign {
    margin-top: 34px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 17px;
    font-weight: 700;
}

.ppd-sign-name {
    border-bottom: 1px solid #111827;
    min-width: 220px;
    text-align: right;
    padding-bottom: 2px;
}

.attachment-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.attachment-empty {
    color: #64748b;
    font-size: 13px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    flex-wrap: wrap;
}

.attachment-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}

.attachment-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.attachment-pdf {
    width: 140px;
    height: 110px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.attachment-icon {
    min-width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #1e293b;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.attachment-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attachment-item a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
}

.attachment-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-attach-save {
    background: #0f766e;
}

.btn-attach-save:hover {
    background: #115e59;
}

.attachment-save-note {
    font-size: 12px;
    color: #64748b;
}

.attachment-edit-label {
    margin-top: 6px;
    font-size: 12px;
    color: #334155;
}

.attachment-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
}

.attachment-drop {
    margin-top: 10px;
    padding: 14px 16px;
    border: 2px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    text-align: center;
    font-size: 13px;
}

.attachment-drop.is-drag {
    background: #e2e8f0;
    border-color: #64748b;
}

.attachment-drop.has-files {
    border-color: #0f766e;
    color: #0f766e;
    background: #ecfdf5;
}

.attachment-drop.is-uploading {
    border-style: solid;
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #f0f9ff;
    position: relative;
    overflow: hidden;
}
.attachment-drop.is-uploading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(14,165,233,.12), rgba(14,165,233,.35), rgba(14,165,233,.12));
    animation: loading-sweep 1.2s infinite;
}
@keyframes loading-sweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.ppd-attach-note {
    color: #475569;
    font-size: 13px;
}

.attachment-meta {
    color: #64748b;
    font-size: 12px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 10px;
    z-index: 99999;
}
.toast {
    min-width: 240px;
    max-width: 420px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #0f172a;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 24px rgba(0,0,0,.12);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in .2s ease;
}
.toast .icon {
    font-size: 16px;
    line-height: 1;
}
.toast.success { border-color: #86efac; background: #f0fdf4; }
.toast.error { border-color: #fecaca; background: #fef2f2; }
.toast.info { border-color: #bae6fd; background: #f0f9ff; }
.toast .dot {
    width: 10px; height: 10px; border-radius: 999px;
    background: #0ea5e9;
}
.toast.success .dot { background: #22c55e; }
.toast.error .dot { background: #ef4444; }
.toast.info .dot { background: #0ea5e9; }
@keyframes toast-in {
    from { transform: translateY(6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== Attachment Cards ===== */
.attachment-list { gap: 10px; }
.attachment-item {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    gap: 12px;
    align-items: flex-start;
    box-shadow: 0 6px 16px rgba(0,0,0,.06);
}
.attachment-info { gap: 4px; }
.attachment-item a { font-weight: 600; }
.attachment-meta { font-size: 12px; color:#64748b; }
.attachment-thumb { border-radius: 8px; object-fit: cover; }
.attachment-pdf { border-radius: 8px; border: 1px solid #e2e8f0; }
.attachment-icon { border-radius: 8px; background: #f1f5f9; }
.btn-attach-remove { border-radius: 8px; }
.btn-attach-view { background: #0ea5e9; color:#fff; border:none; border-radius:8px; padding:6px 10px; font-size:12px; cursor:pointer; }

/* ===== Attachment Modal ===== */
.attachment-modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 9999; }
.attachment-modal.show { display: flex; }
.attachment-modal-panel { width: min(960px, 95vw); max-height: 90vh; background: #fff; border-radius: 12px; box-shadow: 0 16px 36px rgba(0,0,0,.25); overflow: hidden; display: flex; flex-direction: column; }
.attachment-modal-head { display:flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #e5e7eb; background: #f8fafc; }
.attachment-modal-body { padding: 12px; background:#fff; display:flex; align-items:center; justify-content:center; }
.attachment-modal-body img { max-width: 100%; max-height: 70vh; border-radius: 10px; }
.attachment-modal-body iframe { width: min(900px, 92vw); height: 70vh; border: none; border-radius: 10px; }
.btn-ghost { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; padding: 6px 10px; cursor: pointer; }

.btn-attach-remove {
    margin-left: auto;
    padding: 6px 10px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-attach-remove:hover {
    background: #b02a37;
}

.ppd-attach {
    margin-top: 24px;
    padding: 14px 16px;
    border: 1px solid #cbd5f5;
    background: #f8fbff;
    border-radius: 8px;
}

.ppd-attach-title {
    font-weight: 700;
    color: #1f2a44;
    margin-bottom: 8px;
}

.ppd-attach-list {
    list-style: disc;
    padding-left: 18px;
}

.ppd-attach-list a {
    color: #0f172a;
    text-decoration: none;
}

/* Санал авах хуудас */
.sanal-card {
    padding: 20px;
}

.sanal-info {
    background-color: #f9f9f9;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #003366;
}

.sanal-card h3 {
    color: #003366;
    margin-bottom: 15px;
    font-size: 18px;
}

.approval-section {
    margin: 20px 0;
}

.approval-section h4 {
    color: #003366;
    margin-bottom: 10px;
}

.approval-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.approval-table th {
    background-color: #003366;
    color: white;
    padding: 8px;
    font-size: 13px;
}

.approval-table td {
    border: 1px solid #ddd;
    padding: 8px;
}

.approval-table input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.sanal-footer {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-top: 2px dashed #003366;
    border-radius: 0 0 6px 6px;
}

/* Хэвлэх */
@media print {
    .no-print {
        display: none !important;
    }
    
    .preview-box {
        border: none;
        margin: 0;
        padding: 0;
    }

    .ppd-doc {
        border: none;
        box-shadow: none;
        margin: 0;
        max-width: none;
        padding: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .navbar-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .form-table, .form-table tbody, .form-table tr, .form-table td {
        display: block;
        width: 100%;
    }
    
    .label-cell {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .preview-header {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}
