/* =============================================
   BULK SMS AGENT SYSTEM - MAIN STYLES
   ============================================= */

/* ---------- RESET & BASE ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --dark: #0f172a;
    --light: #f8fafc;
    --gray: #94a3b8;
    --gray-light: #e2e8f0;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ---------- UTILITY ---------- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn i {
    font-size: 16px;
}

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

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover {
    background: #16a34a;
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background: #dc2626;
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}
.btn-warning:hover {
    background: #d97706;
    color: var(--white);
}

.btn-info {
    background: var(--info);
    color: var(--white);
}
.btn-info:hover {
    background: #0284c7;
    color: var(--white);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}
.btn-secondary:hover {
    background: #475569;
    color: var(--white);
}

.btn-block {
    display: block;
    width: 100%;
    justify-content: center;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

/* ---------- BADGES ---------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary { background: var(--primary); color: var(--white); }
.badge-success { background: var(--success); color: var(--white); }
.badge-danger { background: var(--danger); color: var(--white); }
.badge-warning { background: var(--warning); color: var(--white); }
.badge-info { background: var(--info); color: var(--white); }
.badge-secondary { background: var(--secondary); color: var(--white); }
.badge-dark { background: var(--dark); color: var(--white); }

/* ---------- FORMS ---------- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
}

.form-group label i {
    margin-right: 6px;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
    color: var(--dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--gray-light);
    cursor: not-allowed;
}

.form-control::placeholder {
    color: var(--gray);
}

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

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.form-row .form-group {
    padding: 0 8px;
}

.col-md-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-7 { flex: 0 0 58.333%; max-width: 58.333%; }
.col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }

/* ---------- ALERTS ---------- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert i {
    font-size: 18px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-danger {
    background: #fecaca;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ---------- CARDS ---------- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 16px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

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

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

.table th {
    background: var(--light);
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 2px solid var(--gray-light);
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f1f5f9;
}

.table-striped tbody tr:nth-child(even) {
    background: #f8fafc;
}

/* ---------- PAGINATION ---------- */
.pagination-wrapper {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 4px;
}

.pagination .page-item .page-link {
    padding: 8px 14px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    color: var(--dark);
    transition: var(--transition);
    background: var(--white);
}

.pagination .page-item .page-link:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--gray);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--secondary);
    font-size: 16px;
}

.empty-state .btn {
    margin-top: 16px;
}

/* ---------- PASSWORD TOGGLE ---------- */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    padding: 4px;
}

.password-toggle:hover {
    color: var(--dark);
}

/* ---------- CHECKBOX LABEL ---------- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ---------- MODAL ---------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 900px;
    margin: 40px auto;
    animation: modalSlideIn 0.3s ease;
}

.modal-lg {
    max-width: 1100px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2 {
    font-size: 20px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header .close {
    font-size: 28px;
    cursor: pointer;
    color: var(--secondary);
    transition: var(--transition);
    line-height: 1;
    background: none;
    border: none;
}

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

.modal-body {
    padding: 24px;
}

.modal-body h3 {
    font-size: 16px;
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
}

.modal-body h3:first-child {
    margin-top: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-light);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ---------- DETAILS GRID ---------- */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.detail-section {
    background: var(--light);
    padding: 16px;
    border-radius: var(--radius);
}

.detail-section h4 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-light);
}

.detail-section p {
    margin: 4px 0;
    font-size: 13px;
}

.detail-section p strong {
    display: inline-block;
    min-width: 120px;
    color: var(--secondary);
    font-weight: 600;
}

.update-section {
    grid-column: 1 / -1;
    background: #f0f7ff;
}

/* ---------- BULK ACTIONS ---------- */
.bulk-actions {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
    margin-bottom: 16px;
}

/* ---------- FILTER FORM ---------- */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-form .form-group {
    margin-bottom: 0;
}

/* ---------- HOMEPAGE ---------- */
.homepage .hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 40px 20px;
}

.hero-content {
    text-align: center;
    color: var(--white);
    max-width: 800px;
}

.hero-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 20px;
    background: var(--white);
    border-radius: 50%;
    padding: 20px;
}

.hero-content h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--gray);
    margin-bottom: 30px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 50px;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.hero-features .feature {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.hero-features .feature:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-4px);
}

.hero-features .feature i {
    font-size: 36px;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.hero-features .feature h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.hero-features .feature p {
    font-size: 13px;
    color: var(--gray);
}

/* ---------- LOGIN/REGISTER PAGES ---------- */
.login-page,
.register-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-container,
.register-container {
    width: 100%;
    max-width: 440px;
}

.login-box,
.register-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.login-header,
.register-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo,
.register-logo {
    width: 220px;
    height: 220px;
    object-fit: contain;
    margin-bottom: 12px;
}

.login-header h1,
.register-header h1 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 4px;
}

.login-header .subtitle,
.register-header .subtitle {
    color: var(--secondary);
    font-size: 14px;
}

.login-form .form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.login-form .forgot-link {
    font-size: 13px;
    color: var(--primary);
}

.login-footer,
.register-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-light);
    font-size: 14px;
    color: var(--secondary);
}

.login-footer a,
.register-footer a {
    font-weight: 600;
}

.register-form .terms {
    margin-top: 12px;
}

/* ---------- RESPONSIVE OVERRIDES ---------- */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .hero-features {
        grid-template-columns: 1fr 1fr;
    }
    
    .login-box,
    .register-box {
        padding: 24px 18px;
    }
    
    .modal-content {
        margin: 20px 0;
        border-radius: var(--radius);
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .col-md-2, .col-md-3, .col-md-4, .col-md-6, .col-md-7, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .form-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .hero-features {
        grid-template-columns: 1fr;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
}