/* === 1. БАЗОВЫЕ НАСТРОЙКИ === */
:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --primary-dark: #2c3e50;
    --btn-color: #bf9b5e;             
    --btn-hover: #a3824a;
    --text-main: #333333;
    --border-radius: 12px;
    --highlight-bg: rgba(191, 155, 94, 0.12);
    --highlight-hover: rgba(191, 155, 94, 0.22);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* === 2. ШАПКА === */
header {
    background-color: var(--primary-dark);
    color: #fff;
    padding: 12px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
}

.header-inner {
    width: 94%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-area {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: #fff; flex-shrink: 0;
}
.magen-david-icon { width: 32px; height: 32px; fill: var(--btn-color); }
.logo-text h1 { margin: 0; font-size: 20px; text-transform: uppercase; font-weight: 700; letter-spacing: 1px; }
.logo-text span { font-size: 11px; opacity: 0.8; display: block; }

.header-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header-nav .btn { width: auto !important; padding: 6px 14px; margin: 0; font-size: 13px; border-radius: 20px; white-space: nowrap; }
.header-nav .logout-btn { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: #eee; }
.header-nav .logout-btn:hover { background: #c0392b; border-color: #c0392b; color: white; }

.lang-link { color: #ccc; text-decoration: none; font-size: 12px; margin-left: 5px; text-transform: uppercase; font-weight: bold; padding: 5px; }
.lang-link:hover, .lang-link.active { color: var(--btn-color); }

/* === 3. КОНТЕЙНЕР === */
.container {
    width: 94%;
    max-width: 1200px;
    margin: 25px auto;
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    flex: 1;
}

input, textarea, select {
    width: 100%; padding: 12px; margin-bottom: 15px;
    border: 1px solid #ddd; border-radius: 6px; font-size: 16px;
    background: #fbfbfb; transition: 0.2s;
}
input:focus { border-color: var(--btn-color); outline: none; background: #fff; }

.btn {
    display: inline-block; width: 100%; padding: 12px;
    background-color: var(--btn-color); color: #fff;
    text-decoration: none; border: none; border-radius: 6px;
    font-size: 16px; font-weight: 600; text-align: center;
    cursor: pointer; transition: background 0.2s;
}
.btn:hover { background-color: var(--btn-hover); }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    color: var(--primary-dark); transition: 0.2s;
}
.btn-icon svg { width: 18px; height: 18px; fill: currentColor; }
.btn-icon:hover { background-color: rgba(44, 62, 80, 0.1); color: var(--btn-color); }

.search-form { display: flex; gap: 10px; margin-bottom: 25px; align-items: center; flex-wrap: wrap; }
.search-form input { margin-bottom: 0; flex: 1; min-width: 150px; }
.search-form .btn { width: auto; padding: 10px 25px; }

/* === 4. ТАБЛИЦА (ПК) === */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 800px; }

table th {
    background-color: var(--primary-dark);
    color: #fff;
    padding: 16px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 3px solid var(--btn-color);
    white-space: nowrap;
}
table th a { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
table th:first-child { border-top-left-radius: var(--border-radius); }
table th:last-child { border-top-right-radius: var(--border-radius); }

table td {
    padding: 14px 12px;
    border-bottom: 1px solid #eee;
    color: #444;
    text-align: center;
    font-size: 14px;
    vertical-align: middle;
}
table tr:last-child td:first-child { border-bottom-left-radius: var(--border-radius); }
table tr:last-child td:last-child { border-bottom-right-radius: var(--border-radius); }
table tr:last-child td { border-bottom: none; }

table th:nth-child(1), table th:nth-child(2), table th:nth-child(3),
table td:nth-child(1), table td:nth-child(2), table td:nth-child(3) {
    text-align: left; padding-left: 20px;
}

table tr:hover td { background-color: #f8f9fa; cursor: pointer; color: #000; }
table tr.has-photo td { background-color: var(--highlight-bg); }
table tr.has-photo:hover td { background-color: var(--highlight-hover); }

/* === 5. МОБИЛЬНАЯ ВЕРСИЯ === */
@media screen and (max-width: 768px) {
    .header-inner { flex-direction: column; text-align: center; }
    .header-nav { justify-content: center; width: 100%; }
    
    .container { 
        padding: 0 15px; width: 100%; max-width: 100%; margin: 20px auto;
        border-radius: 0; box-shadow: none; background: transparent; 
    }
    
    .search-form { 
        flex-direction: column; align-items: stretch; background: #fff; 
        padding: 15px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    .search-form .btn { width: 100%; }

    .table-responsive { overflow: visible; box-shadow: none; border-radius: 0; width: 100%; background: transparent; }
    table { min-width: 0 !important; width: 100%; display: block; background: transparent; }
    thead, tbody, th, td, tr { display: block; width: 100%; }
    thead { display: none; }

    tbody tr {
        background-color: #fff; border: 1px solid #e0e0e0; overflow: hidden; 
        border-radius: 16px; margin-bottom: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        padding: 0; width: 100%;
    }
    
    tbody tr.has-photo { background-color: var(--highlight-bg) !important; border: 2px solid var(--btn-color); }

    table td {
        display: flex !important; justify-content: space-between !important; align-items: center !important;
        padding: 14px 20px !important; text-align: right !important;
        border-bottom: 1px solid rgba(0,0,0,0.05) !important; background-color: transparent !important; 
        min-height: 50px; width: 100% !important;
    }
    table tr:last-child td:first-child, table tr:last-child td:last-child { border-radius: 0 !important; }
    table td:last-child { border-bottom: none !important; }

    td::before {
        content: attr(data-label); font-weight: 700; color: var(--primary-dark);
        font-size: 13px; text-transform: uppercase; text-align: left; padding-right: 15px; flex-shrink: 0;
    }
    td > * { margin-left: auto; text-align: right; }
    td .btn-icon { margin-left: auto; }
}

/* === 6. ЛОГИН И ПОДВАЛ === */
.login-wrapper { display: flex; justify-content: center; padding: 20px; width: 100%; }
.login-card { width: 100%; max-width: 360px; padding: 40px 25px; background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); text-align: center; }
.login-icon { font-size: 44px; color: var(--btn-color); display: block; margin-bottom: 15px; }
.back-link { display: block; margin-top: 30px; color: #888; text-decoration: none; font-size: 14px; }

.site-footer { background-color: var(--primary-dark); color: #ccc; padding: 40px 0 20px; margin-top: auto; }
.footer-content { width: 94%; max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 30px; }
.footer-section { min-width: 200px; flex: 1; }
.footer-section h3 { color: #fff; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 10px; margin-bottom: 15px; }
.footer-links a { color: #aaa; text-decoration: none; display: block; margin-bottom: 8px; }
.footer-copyright { text-align: center; margin-top: 30px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 20px; }


/* === 7. МОДАЛКА (POPUP) === */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.85); 
    backdrop-filter: blur(4px); 
    align-items: center; 
    justify-content: center;
    padding: 10px; 
}

.modal-content { 
    background-color: #fff; 
    border-radius: 16px; 
    width: 100%; 
    max-width: 420px; 
    max-height: 90vh;
    
    display: flex;
    flex-direction: column;
    
    text-align: center !important; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important; 
    font-size: 16px;
    
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    padding: 0;
    overflow-y: auto; 
    position: relative;
}

.close-btn { 
    position: sticky; 
    top: 0;
    right: 0;
    display: block;
    width: 100%;
    text-align: right;
    padding: 12px 20px;
    background: #fff; 
    border-bottom: 1px solid #f0f0f0; 
    font-size: 26px; 
    line-height: 1;
    cursor: pointer; 
    color: #bbb; 
    z-index: 100;
}
.close-btn:hover { color: #333; }

/* Текст */
.modal-content p {
    margin: 8px 0;
    padding: 0 20px; 
    line-height: 1.4;
    color: #333;
    text-align: center; 
}

.modal-content strong, 
.modal-content b {
    color: var(--primary-dark);
    display: inline-block; 
}

/* === НАСТРОЙКИ ФОТОГРАФИИ === */

/* Скрываем подпись "Foto" только перед картинкой */
.modal-content p:has(img) strong,
.modal-content p:has(img) b {
    display: none !important;
}

.modal-content p:has(img) {
    margin-top: 5px !important;
    margin-bottom: 15px !important;
    padding: 0 10px;
    line-height: 0;
}

/* Сама картинка */
.modal-content img {
    display: inline-block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 40vh; 
    
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    
    /* ОТКЛЮЧЕНИЕ КЛИКОВ ПО КАРТИНКЕ */
    pointer-events: none; 
    cursor: default;
}