@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #090d16;
    --bg-card: rgba(17, 25, 40, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --secondary: #a855f7;
    --accent: #d946ef;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-speed: 0.3s;
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 3rem;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Typography Helpers */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-speed);
}
a:hover {
    color: var(--accent);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-danger {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Glassmorphism Card Style */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

/* Login Page Container */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90vh;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    text-align: center;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    box-shadow: 0 0 15px var(--primary-glow);
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.login-card h2 {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Inputs & Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(255, 255, 255, 0.08);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-icon-only {
    padding: 0.5rem;
    border-radius: 6px;
}

/* Layout Wrapper */
.app-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1.5rem;
    animation: fadeIn 0.5s ease;
}

/* Navigation / Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Dashboard Grid & Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-card.success-stat::before {
    background: var(--success);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 0.25rem;
    background: linear-gradient(to right, #ffffff, #e9d5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Main Dashboard Columns */
.dashboard-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .dashboard-body {
        grid-template-columns: 7fr 3fr;
    }
}

/* Cards & Section Titles */
.section-card {
    padding: 1.5rem;
    height: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Custom badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success-glow);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: var(--danger-glow);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 1.8s infinite;
}

.status-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: pulse-danger 1.8s infinite;
}

.status-dot.inactive {
    background-color: var(--text-muted);
}

/* Table Style */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.custom-table th {
    padding: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.custom-table tr:last-child td {
    border-bottom: none;
}

.custom-table tbody tr {
    transition: background-color var(--transition-speed);
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.site-name-cell {
    font-weight: 500;
    color: white;
}

.site-url-cell {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Action button list */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Right-side Timeline/Logs list */
.log-timeline {
    max-height: 450px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.log-item {
    padding: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: background var(--transition-speed);
}

.log-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.log-item:last-child {
    border-bottom: none;
}

.log-meta {
    display: flex;
    justify-content: space-between;
}

.log-site {
    font-weight: 600;
    color: white;
}

.log-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.log-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.log-msg {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Hostinger Cron Guide Container */
.integration-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
}

.integration-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cron-command-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    margin: 0.75rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    word-break: break-all;
}

.cron-command-box code {
    color: #c084fc;
    user-select: all;
}

/* Modals Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    width: 95%;
    max-width: 500px;
    transform: translateY(-30px);
    transition: transform var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 2rem;
    animation: fadeIn 0.4s ease;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-speed);
}

.modal-close:hover {
    color: white;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* Toast System */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1100;
}

.toast {
    background: rgba(17, 25, 40, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    color: white;
    transform: translateX(100%);
    animation: slideIn 0.3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: opacity var(--transition-speed);
}

@keyframes slideIn {
    to { transform: translateX(0); }
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

.toast.toast-info {
    border-left: 4px solid var(--primary);
}

.toast-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.toast-content {
    font-size: 0.9rem;
    flex: 1;
}

/* Loader Styles */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.btn .spinner {
    margin-right: 0.5rem;
}

.page-loader {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    gap: 1rem;
    color: var(--text-muted);
}

.page-loader .spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    border-top-color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* Utility classes */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.cursor-pointer { cursor: pointer; }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* Form switches */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
}
