﻿/* CSS Variables */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f1f5f9;
    --card-background: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-text: #e2e8f0;
    --sidebar-hover: #334155;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.2s ease;

    /* Provider Colors */
    --sevenio-color: #00d573;
    --sevenio-color-dark: #00b960;
    --esendex-color: #440f5c;
    --esendex-color-dark: #5c1476;
    --sms77-color: #64748b;
    --sms77-color-dark: #475569;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-overlay.hidden {
    display: none;
}

.login-card {
    background: var(--card-background);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 1.5rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    margin-top: 0;
}

.login-header p {
    color: var(--text-secondary);
    margin-bottom: 0;
}

.login-form {
    margin-top: 2rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-hint {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

.app.hidden {
    display: none;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header i {
    color: var(--primary-color);
}

.nav-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--sidebar-hover);
}

.nav-item.active {
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn {
    width: 100%;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border: none;
}

.sidebar-footer .btn:hover {
    background: var(--primary-hover);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: var(--card-background);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.user-info i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.content-area {
    padding: 2rem;
    flex: 1;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.card h2 i {
    color: var(--primary-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Dashboard Row */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

/* Chart Container */
.chart-card {
    min-height: 350px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* Top Accounts List */
.top-accounts-list {
    max-height: 280px;
    overflow-y: auto;
}

.top-account-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.top-account-item:hover {
    background: var(--background-color);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: var(--border-radius);
}

.top-account-item:last-child {
    border-bottom: none;
}

.top-account-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.top-account-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.top-account-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.top-account-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.top-account-count {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* Success Rate */
.success-rate-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.success-rate-bar {
    flex: 1;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.success-rate-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #16a34a);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.success-rate-container > span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
    min-width: 80px;
    text-align: right;
}

.success-rate-info {
    display: flex;
    gap: 2rem;
    color: var(--text-secondary);
}

.success-rate-info i.fa-check-circle {
    color: var(--success-color);
}

.success-rate-info i.fa-times-circle {
    color: var(--danger-color);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.inline-form {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
}

.inline-form .form-group {
    min-width: 150px;
}

.inline-form .flex-grow {
    flex: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--background-color);
}

.data-table tbody tr:hover {
    background: var(--background-color);
}

.data-table tbody tr.table-footer-note:hover {
    background: transparent;
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active,
.status-badge.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.status-badge.inactive,
.status-badge.failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge.sent {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-badge.master {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.role-badge.regular {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content .form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* SMS Status Display */
.status-display {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
}

.status-icon-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: var(--border-color);
    color: var(--text-secondary);
}

.status-icon-large.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.status-icon-large.failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-icon-large.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-icon-large.sent {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.status-details p {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Result Info */
.result-info {
    background: var(--background-color);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.result-info p {
    margin-bottom: 0.5rem;
}

.result-info p:last-child {
    margin-bottom: 0;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast.info {
    background: var(--primary-color);
}

/* Loading State */
.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* Provider Badge */
.provider-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #e0e7ff;
    color: #3730a3;
    transition: var(--transition);
    white-space: nowrap;
}

/* Seven.io Provider Badge - Grün */
.provider-badge.sevenio {
    background: rgba(0, 213, 115, 0.15);
    color: var(--sevenio-color-dark);
}

/* Esendex Provider Badge - Lila */
.provider-badge.esendex {
    background: rgba(68, 15, 92, 0.15);
    color: var(--esendex-color-dark);
}

/* SMS77 Provider Badge - Standard/Grau */
.provider-badge.sms77 {
    background: rgba(100, 116, 139, 0.15);
    color: var(--sms77-color-dark);
}

/* Standard Provider Badge - Blau */
.provider-badge.standard {
    background: rgba(99, 102, 241, 0.15);
    color: #4338ca;
}

/* Provider select styling */
#accountProvider {
    font-size: 1rem;
}

#accountProvider option {
    padding: 0.5rem;
}

/* SMS ID Short Display */
.sms-id-short {
    cursor: pointer;
    font-size: 0.85rem;
}

.sms-id-short:hover {
    color: var(--primary-color);
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Skeleton Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.chart-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2rem;
    padding: 2.5rem 3rem;
    background: var(--card-background);
    z-index: 10;
}

.chart-skeleton.hidden {
    display: none !important;
}

.skeleton-bar {
    width: 32px;
    background: linear-gradient(
        90deg,
        #f1f5f9 0%,
        #e2e8f0 50%,
        #f1f5f9 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
    border-radius: 6px 6px 0 0;
    opacity: 0.8;
}

.skeleton-bar:nth-child(1) {
    height: 55%;
    animation-delay: 0s;
}

.skeleton-bar:nth-child(2) {
    height: 75%;
    animation-delay: 0.2s;
}

.skeleton-bar:nth-child(3) {
    height: 40%;
    animation-delay: 0.4s;
}

.skeleton-bar:nth-child(4) {
    height: 65%;
    animation-delay: 0.6s;
}

.skeleton-bar:nth-child(5) {
    height: 50%;
    animation-delay: 0.8s;
}

.skeleton-bar:nth-child(6) {
    height: 70%;
    animation-delay: 1.0s;
}

/* List Skeleton */
.skeleton-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-item:last-child {
    border-bottom: none;
}

.skeleton-line {
    height: 18px;
    background: linear-gradient(
        90deg,
        #f1f5f9 0%,
        #e2e8f0 50%,
        #f1f5f9 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
    border-radius: 4px;
    width: 80%;
    opacity: 0.8;
}

.skeleton-item:nth-child(2) .skeleton-line {
    width: 65%;
    animation-delay: 0.2s;
}

.skeleton-item:nth-child(3) .skeleton-line {
    width: 75%;
    animation-delay: 0.4s;
}

/* Skeleton Stat Card */
.stat-card.loading .stat-info h3,
.stat-card.loading .stat-info p {
    background: linear-gradient(
        90deg,
        var(--border-color) 0%,
        #d1d5db 20%,
        var(--border-color) 40%,
        var(--border-color) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    color: transparent;
}

/* Chart container with canvas hidden during loading */
.chart-container canvas {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.chart-container.loading canvas {
    opacity: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-header span,
    .nav-item span,
    .sidebar-footer .btn span {
        display: none;
    }
    
    .sidebar-header {
        justify-content: center;
    }
    
    .nav-item {
        justify-content: center;
        padding: 1rem;
    }
    
    .nav-item i {
        margin: 0;
    }
    
    .sidebar-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    .main-content {
        margin-left: 70px;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .inline-form {
        flex-direction: column;
    }
    
    .inline-form .form-group {
        width: 100%;
    }
}
