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

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background: #f4f6f9;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

a {
    color: #2c6fce;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Site Header ===== */
.site-header {
    background: #1a1a2e;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.site-logo {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    padding: 0 24px;
    line-height: 48px;
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.site-logo:hover {
    text-decoration: none;
    color: #fff;
}

.category-nav {
    display: flex;
    gap: 0;
    margin-left: 8px;
}

.category-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0 20px;
    line-height: 48px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.category-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.category-nav a.active {
    color: #fff;
    border-bottom-color: #5b9cf6;
    background: rgba(255, 255, 255, 0.08);
}

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

h1 {
    font-size: 22px;
    color: #1a1a2e;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 2px solid #2c6fce;
}

/* ===== Home Cards ===== */
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.home-card {
    display: flex;
    flex-direction: column;
    padding: 28px 24px;
    background: #f8f9fb;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    transition: all 0.2s;
    color: #333;
    position: relative;
}

.home-card:hover {
    text-decoration: none;
    border-color: #2c6fce;
    box-shadow: 0 4px 16px rgba(44, 111, 206, 0.12);
    transform: translateY(-2px);
}

.home-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.home-card-count {
    font-size: 32px;
    font-weight: 700;
    color: #2c6fce;
    line-height: 1;
}

.home-card-count span {
    font-size: 14px;
    font-weight: 400;
    color: #888;
    margin-left: 4px;
}

.home-card-arrow {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #ccc;
    transition: all 0.2s;
}

.home-card:hover .home-card-arrow {
    color: #2c6fce;
    right: 20px;
}

/* ===== Search Form ===== */
.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    align-items: center;
}

.search-form select {
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #333;
}

.search-form input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    width: 250px;
}

.search-form input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-date-sep {
    color: #888;
    font-size: 13px;
    flex-shrink: 0;
}

.search-form input[type="text"]:focus,
.search-form input[type="date"]:focus,
.search-form select:focus {
    outline: none;
    border-color: #2c6fce;
    box-shadow: 0 0 0 3px rgba(44, 111, 206, 0.15);
}

/* ===== Board Info ===== */
.board-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.board-info-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.per-page-select {
    padding: 5px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
    color: #555;
    cursor: pointer;
}

.per-page-select:focus {
    outline: none;
    border-color: #2c6fce;
}

/* ===== Table - List ===== */
.board-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.board-table thead th {
    background: #f8f9fb;
    padding: 10px 8px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
    border-top: 2px solid #333;
    border-bottom: 1px solid #ddd;
    text-align: center;
    white-space: nowrap;
}

.board-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.board-table tbody tr:hover {
    background: #f8faff;
}

.board-table tbody tr.clickable-row {
    cursor: pointer;
}

.board-table tbody tr.clickable-row:hover {
    background: #eef3ff;
}

.center {
    text-align: center;
}

.ellipsis {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-data {
    text-align: center;
    padding: 40px 0 !important;
    color: #999;
    font-size: 14px;
}

/* Column widths */
.col-no { width: 60px; }
.col-system { width: 80px; }
.col-phone { width: 120px; }
.col-status { width: 70px; }
.col-desc { min-width: 180px; }
.col-start { width: 130px; }
.col-end { width: 130px; }
.col-duration { width: 80px; }
.duration-text { color: #888; font-size: 12px; font-variant-numeric: tabular-nums; }
.col-audio { width: 50px; }
.col-date { width: 100px; }

/* ===== Table - View ===== */
.view-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    border-top: 2px solid #333;
}

.view-table th,
.view-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.view-table th {
    background: #f8f9fb;
    width: 140px;
    color: #555;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.view-table td {
    color: #333;
}

.call-desc {
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== Audio ===== */
.btn-audio-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid #d0d5dd;
    border-radius: 50%;
    background: #fff;
    color: #2c6fce;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.btn-audio-play:hover {
    background: #2c6fce;
    color: #fff;
    border-color: #2c6fce;
}

.audio-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audio-cell audio {
    height: 36px;
    flex: 1;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ===== Badge ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-connected {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-missed {
    background: #fff3e0;
    color: #e65100;
}

.badge-rejected {
    background: #fce4ec;
    color: #c62828;
}

.badge-failed {
    background: #efebe9;
    color: #5d4037;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.85;
}

.btn-primary {
    background: #2c6fce;
    color: #fff;
}

.btn-default {
    background: #f0f0f0;
    color: #555;
    border: 1px solid #d0d5dd;
}

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

.btn-search {
    background: #333;
    color: #fff;
}

.btn-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 10px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    background: #fff;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #f0f4ff;
    border-color: #2c6fce;
    color: #2c6fce;
    text-decoration: none;
}

.pagination a.active {
    background: #2c6fce;
    border-color: #2c6fce;
    color: #fff;
    font-weight: 600;
}

/* ===== Write Form ===== */
.write-form fieldset {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.write-form legend {
    font-size: 14px;
    font-weight: 600;
    color: #2c6fce;
    padding: 0 8px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group.full {
    width: 100%;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c6fce;
    box-shadow: 0 0 0 3px rgba(44, 111, 206, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== Admin Styles ===== */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
}

.alert-danger {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.alert-danger p {
    margin: 2px 0;
}

.required {
    color: #e74c3c;
}

.field-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

.field-table {
    margin-bottom: 0;
}

.field-label-input {
    width: 100%;
    padding: 6px 10px !important;
    font-size: 13px;
}

.form-group small {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* ===== Login Page ===== */
.login-body {
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-title {
    font-size: 22px;
    color: #1a1a2e;
    text-align: center;
    border-bottom: none;
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-bottom: 28px;
}

.login-form .alert {
    margin-bottom: 16px;
}

.login-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #333;
    margin-bottom: 16px;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.login-field input:focus {
    outline: none;
    border-color: #2c6fce;
    box-shadow: 0 0 0 3px rgba(44, 111, 206, 0.15);
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
}

/* ===== Header User Info ===== */
.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding: 0 20px;
    white-space: nowrap;
}

.header-user-center {
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
}

.header-user-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.header-logout {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: all 0.2s;
}

.header-logout:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}

/* ===== Role Badges ===== */
.badge-role-admin {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-role-manager {
    background: #fff3e0;
    color: #e65100;
}

.badge-role-user {
    background: #e8f5e9;
    color: #2e7d32;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-logo {
        padding: 0 16px;
        line-height: 42px;
    }

    .category-nav {
        width: 100%;
        overflow-x: auto;
        margin-left: 0;
    }

    .category-nav a {
        padding: 0 14px;
        font-size: 13px;
        line-height: 38px;
    }

    .container {
        margin: 10px;
        padding: 15px;
    }

    .search-form {
        flex-wrap: wrap;
    }

    .search-form input[type="text"] {
        width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .board-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .col-start,
    .col-end {
        display: none;
    }

    .header-user {
        padding: 6px 16px 8px;
        margin-left: 0;
    }
}
