/**
 * OKX-SMS Platform - Ana Stil Dosyası
 * Swiss & High-Contrast Light Theme
 */

/* ========== CSS Variables ========== */
:root {
    --primary: #0A0A0A;
    --primary-fg: #FFFFFF;
    --secondary: #F4F4F5;
    --secondary-fg: #0A0A0A;
    --accent: #002FA7;
    --accent-fg: #FFFFFF;
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --border: #E4E4E7;
    --muted: #A1A1AA;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --info: #002FA7;
    --radius: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --font-heading: 'Manrope', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --sidebar-w: 256px;
    --header-h: 60px;
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-body);
    color: var(--primary);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #001d6e; }

img { max-width: 100%; }

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

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

.login-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.login-header h1 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--muted);
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--muted);
}

/* ========== Form Elements ========== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--bg);
    color: var(--primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,47,167,0.1);
}

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

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
}

.input-icon input {
    padding-left: 40px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row .col-2 { flex: 0 0 calc(16.66% - 14px); }
.form-row .col-3 { flex: 0 0 calc(25% - 12px); }
.form-row .col-4 { flex: 0 0 calc(33.33% - 11px); }
.form-row .col-6 { flex: 0 0 calc(50% - 8px); }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.char-counter, .phone-counter {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

.filter-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--primary);
    color: var(--primary-fg);
    border-color: var(--primary);
}
.btn-primary:hover { background: #222; color: #fff; }

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-fg);
    border-color: var(--border);
}
.btn-secondary:hover { background: #E8E8E9; color: var(--secondary-fg); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ========== Alerts ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid;
}

.alert i { margin-top: 2px; }

.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.alert-link { color: inherit; text-decoration: underline; font-weight: 600; }

.error-list { list-style: none; margin: 0; padding: 0; }
.error-list li { margin-bottom: 4px; }

/* ========== Layout ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.5px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand i {
    color: var(--accent);
    font-size: 20px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--secondary-fg);
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-link:hover {
    background: var(--secondary);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: var(--primary-fg);
}

.nav-link i {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-balance {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.sidebar-balance i { font-size: 20px; }
.sidebar-balance small { font-size: 11px; opacity: 0.8; display: block; }
.sidebar-balance strong { font-size: 18px; display: block; }

.logout-link { color: var(--error) !important; }
.logout-link:hover { background: #fef2f2 !important; }

/* Header */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-header {
    height: var(--header-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.header-user i { font-size: 22px; color: var(--muted); }

.user-role-badge {
    background: var(--secondary);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Content */
.main-content {
    padding: 24px;
    flex: 1;
    background: #FAFAFA;
}

/* ========== Page Header ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i { color: var(--accent); font-size: 22px; }

.page-header p {
    color: var(--muted);
    font-size: 14px;
    margin-top: 2px;
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stats-grid--small {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card--balance::before { background: var(--accent); }
.stat-card--sent::before { background: var(--success); }
.stat-card--rate::before { background: var(--warning); }
.stat-card--campaigns::before { background: #8B5CF6; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.mini {
    padding: 16px;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon--blue { background: #EFF6FF; color: var(--accent); }
.stat-icon--green { background: #ECFDF5; color: var(--success); }
.stat-icon--yellow { background: #FFFBEB; color: var(--warning); }
.stat-icon--purple { background: #F5F3FF; color: #8B5CF6; }

.stat-info { flex: 1; }

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.2;
}

.stat-card.mini .stat-value {
    font-size: 22px;
}

.stat-sub {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}

.stat-sub.success { color: var(--success); }
.stat-sub.warning { color: var(--warning); }
.stat-sub.danger { color: var(--error); }

.stat-link {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    margin-top: 6px;
}

/* ========== Dashboard Grid ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 18px;
}

/* ========== Cards ========== */
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--muted); font-size: 14px; }

.card-body {
    padding: 20px;
}

/* ========== Tables ========== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: var(--secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #FAFAFA;
}

.data-table tbody td i {
    color: var(--muted);
    margin-right: 6px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #ECFDF5; color: #065F46; }
.badge-danger { background: #FEF2F2; color: #991B1B; }
.badge-warning { background: #FFFBEB; color: #92400E; }
.badge-info { background: #EFF6FF; color: #1E40AF; }
.badge-secondary { background: var(--secondary); color: var(--muted); }

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 8px;
    background: #EFF6FF;
    color: var(--accent);
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
}

/* ========== Quick Actions ========== */
.quick-actions-card .card-body { padding: 0; }

.quick-action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--primary);
    transition: background 0.2s;
}

.quick-action:last-child { border-bottom: none; }
.quick-action:hover { background: var(--secondary); }

.quick-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.bg-blue { background: var(--accent); }
.bg-green { background: var(--success); }
.bg-purple { background: #8B5CF6; }
.bg-yellow { background: var(--warning); }

.quick-action-text { flex: 1; }
.quick-action-text strong { display: block; font-size: 14px; }
.quick-action-text span { font-size: 12px; color: var(--muted); }
.quick-action > i:last-child { color: var(--muted); font-size: 12px; }

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 14px;
}

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

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    transition: all 0.2s;
}

.page-link:hover { background: var(--secondary); }
.page-link.active {
    background: var(--primary);
    color: var(--primary-fg);
    border-color: var(--primary);
}

/* ========== Modals ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover { color: var(--primary); }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========== Misc ========== */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--error) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--muted) !important; }

.balance-display {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 6px 14px;
    background: #EFF6FF;
    border-radius: var(--radius);
    color: var(--accent);
}

.message-preview {
    background: var(--secondary);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.message-preview strong {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.detail-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 13px;
}

.detail-meta span { display: flex; gap: 6px; }

.api-status-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.filter-form .form-row {
    align-items: flex-end;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .form-row .col-2,
    .form-row .col-3,
    .form-row .col-4 {
        flex: 0 0 calc(50% - 8px);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .stats-grid,
    .stats-grid--small {
        grid-template-columns: 1fr 1fr;
    }
    .form-row .col-2,
    .form-row .col-3,
    .form-row .col-4,
    .form-row .col-6 {
        flex: 0 0 100%;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .stats-grid,
    .stats-grid--small {
        grid-template-columns: 1fr;
    }
    .main-content {
        padding: 16px;
    }
}
