/* ============================================
   r2G-sms — Styles principaux
   ============================================ */

:root {
    --r2g-primary: #4F46E5;
    --r2g-primary-light: #6366F1;
    --r2g-primary-dark: #3730A3;
    --r2g-accent: #10B981;
    --r2g-danger: #EF4444;
    --r2g-warning: #F59E0B;
    --r2g-sidebar-bg: #1E1B4B;
    --r2g-sidebar-text: #C7D2FE;
    --r2g-sidebar-active: #4F46E5;
    --r2g-sidebar-width: 260px;
    --r2g-bg: #F8FAFC;
    --r2g-card-bg: #FFFFFF;
    --r2g-text: #1E293B;
    --r2g-text-muted: #64748B;
    --r2g-border: #E2E8F0;
    --r2g-radius: 12px;
    --r2g-radius-sm: 8px;
    --r2g-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --r2g-shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--r2g-bg);
    color: var(--r2g-text);
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */
.r2g-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--r2g-sidebar-width);
    background: var(--r2g-sidebar-bg);
    color: var(--r2g-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.r2g-sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.r2g-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.r2g-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--r2g-primary);
    border-radius: 10px;
    font-size: 1.1rem;
    color: white;
}

.r2g-logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.r2g-logo-text span {
    color: var(--r2g-accent);
}

.r2g-sidebar-toggle {
    background: none;
    border: none;
    color: var(--r2g-sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
}

.r2g-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.r2g-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: var(--r2g-sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.r2g-nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: white;
}

.r2g-nav-item.active {
    background: rgba(79, 70, 229, 0.2);
    color: white;
    border-left-color: var(--r2g-primary-light);
}

.r2g-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.r2g-nav-separator {
    padding: 1rem 1.5rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.3);
}

.r2g-sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.r2g-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
}

.r2g-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--r2g-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.r2g-user-details {
    overflow: hidden;
}

.r2g-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.r2g-user-email {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.r2g-logout {
    color: rgba(255,255,255,0.4) !important;
    font-size: 0.8rem;
}

.r2g-logout:hover {
    color: var(--r2g-danger) !important;
}

/* ============================================
   Main content
   ============================================ */
.r2g-main {
    margin-left: var(--r2g-sidebar-width);
    min-height: 100vh;
}

.r2g-content {
    padding: 2rem;
    max-width: 1200px;
}

.r2g-topbar {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid var(--r2g-border);
    position: sticky;
    top: 0;
    z-index: 500;
}

.r2g-menu-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--r2g-text);
    cursor: pointer;
}

.r2g-logo-small {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--r2g-primary-dark);
}

.r2g-logo-small span {
    color: var(--r2g-accent);
}

/* ============================================
   Page header
   ============================================ */
.r2g-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.r2g-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--r2g-text);
    margin: 0;
}

.r2g-page-subtitle {
    font-size: 0.875rem;
    color: var(--r2g-text-muted);
    margin-top: 0.25rem;
}

/* ============================================
   Cards / Widgets
   ============================================ */
.r2g-card {
    background: var(--r2g-card-bg);
    border-radius: var(--r2g-radius);
    box-shadow: var(--r2g-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--r2g-border);
}

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

.r2g-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.r2g-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.r2g-stat-card {
    background: var(--r2g-card-bg);
    border-radius: var(--r2g-radius);
    box-shadow: var(--r2g-shadow);
    padding: 1.25rem;
    border: 1px solid var(--r2g-border);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

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

.r2g-stat-icon.blue { background: #EEF2FF; color: var(--r2g-primary); }
.r2g-stat-icon.green { background: #ECFDF5; color: var(--r2g-accent); }
.r2g-stat-icon.orange { background: #FFF7ED; color: var(--r2g-warning); }
.r2g-stat-icon.red { background: #FEF2F2; color: var(--r2g-danger); }

.r2g-stat-label {
    font-size: 0.75rem;
    color: var(--r2g-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.r2g-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--r2g-text);
    line-height: 1.2;
}

.r2g-stat-detail {
    font-size: 0.75rem;
    color: var(--r2g-text-muted);
    margin-top: 0.15rem;
}

/* ============================================
   Buttons
   ============================================ */
.r2g-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    border-radius: var(--r2g-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.r2g-btn-primary {
    background: var(--r2g-primary);
    color: white;
}

.r2g-btn-primary:hover {
    background: var(--r2g-primary-dark);
    color: white;
}

.r2g-btn-success {
    background: var(--r2g-accent);
    color: white;
}

.r2g-btn-success:hover {
    background: #059669;
    color: white;
}

.r2g-btn-outline {
    background: white;
    color: var(--r2g-text);
    border: 1px solid var(--r2g-border);
}

.r2g-btn-outline:hover {
    background: var(--r2g-bg);
    color: var(--r2g-text);
}

.r2g-btn-danger {
    background: var(--r2g-danger);
    color: white;
}

.r2g-btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.r2g-btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

/* ============================================
   Tables
   ============================================ */
.r2g-table {
    width: 100%;
    border-collapse: collapse;
}

.r2g-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--r2g-text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--r2g-border);
    text-align: left;
}

.r2g-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--r2g-border);
    font-size: 0.875rem;
    vertical-align: middle;
}

.r2g-table tr:hover {
    background: rgba(79, 70, 229, 0.02);
}

/* ============================================
   Badges
   ============================================ */
.r2g-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.r2g-badge-success { background: #ECFDF5; color: #065F46; }
.r2g-badge-danger { background: #FEF2F2; color: #991B1B; }
.r2g-badge-warning { background: #FFF7ED; color: #92400E; }
.r2g-badge-info { background: #EEF2FF; color: #3730A3; }
.r2g-badge-gray { background: #F1F5F9; color: #475569; }

/* ============================================
   Forms
   ============================================ */
.r2g-form-group {
    margin-bottom: 1.25rem;
}

.r2g-form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--r2g-text);
    margin-bottom: 0.35rem;
}

.r2g-form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--r2g-border);
    border-radius: var(--r2g-radius-sm);
    font-size: 0.875rem;
    color: var(--r2g-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background: white;
}

.r2g-form-control:focus {
    outline: none;
    border-color: var(--r2g-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.r2g-form-hint {
    font-size: 0.75rem;
    color: var(--r2g-text-muted);
    margin-top: 0.25rem;
}

/* ============================================
   Login page
   ============================================ */
.r2g-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
    padding: 1rem;
}

.r2g-login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.r2g-login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.r2g-login-logo .r2g-logo-icon {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
    margin: 0 auto 0.75rem;
}

.r2g-login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--r2g-text);
}

.r2g-login-logo h1 span {
    color: var(--r2g-accent);
}

.r2g-login-logo p {
    color: var(--r2g-text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.r2g-login-error {
    background: #FEF2F2;
    color: #991B1B;
    padding: 0.75rem 1rem;
    border-radius: var(--r2g-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.r2g-login-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--r2g-primary);
    color: white;
    border: none;
    border-radius: var(--r2g-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.r2g-login-btn:hover {
    background: var(--r2g-primary-dark);
}

.r2g-login-footer {
    text-align: center;
    margin-top: 1.25rem;
}

.r2g-login-footer a {
    color: var(--r2g-primary);
    font-size: 0.85rem;
    text-decoration: none;
}

.r2g-login-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   SMS Send page specifics
   ============================================ */
.r2g-char-counter {
    font-size: 0.75rem;
    color: var(--r2g-text-muted);
    text-align: right;
    margin-top: 0.25rem;
}

.r2g-char-counter.warning { color: var(--r2g-warning); }
.r2g-char-counter.danger { color: var(--r2g-danger); }

/* ============================================
   Empty state
   ============================================ */
.r2g-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--r2g-text-muted);
}

.r2g-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.r2g-empty p {
    font-size: 0.9rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991.98px) {
    .r2g-sidebar {
        transform: translateX(-100%);
    }

    .r2g-sidebar.open {
        transform: translateX(0);
    }

    .r2g-main {
        margin-left: 0;
    }

    .r2g-topbar {
        display: flex;
    }

    .r2g-content {
        padding: 1rem;
    }

    .r2g-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575.98px) {
    .r2g-stat-grid {
        grid-template-columns: 1fr;
    }

    .r2g-page-header {
        flex-direction: column;
    }

    .r2g-login-card {
        padding: 1.5rem;
    }
}
