/**
 * Hetzner Cloud WHMCS Module - Client Styles
 * 
 * @package    HetznerCloud
 * @author     Eng. Mahmoud
 * @version    1.0.0
 */

/* Variables */
:root {
    --hetzner-primary: #d50c2d;
    --hetzner-primary-dark: #b30a26;
    --hetzner-secondary: #333;
    --hetzner-success: #28a745;
    --hetzner-danger: #dc3545;
    --hetzner-warning: #ffc107;
    --hetzner-info: #17a2b8;
    --hetzner-border: #dee2e6;
    --hetzner-bg-light: #f8f9fa;
}

/* Main Container */
.hetzner-cloud-panel {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Alerts Container */
.hetzner-alerts {
    margin-bottom: 20px;
}

.hetzner-alert {
    border-radius: 4px;
}

/* Loading Overlay */
.hetzner-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.hetzner-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--hetzner-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Server Header */
.server-header {
    background: linear-gradient(135deg, var(--hetzner-secondary) 0%, #1a1a1a 100%);
    color: #fff;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.server-header h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
}

.server-header .server-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.server-header .info-item {
    display: flex;
    flex-direction: column;
}

.server-header .info-label {
    font-size: 12px;
    color: #aaa;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.server-header .info-value {
    font-size: 14px;
    font-weight: 500;
}

/* Status Badges */
.server-status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.server-status-badge.running {
    background: var(--hetzner-success);
    color: #fff;
}

.server-status-badge.off {
    background: var(--hetzner-danger);
    color: #fff;
}

.server-status-badge.starting,
.server-status-badge.stopping,
.server-status-badge.rebuilding {
    background: var(--hetzner-warning);
    color: #000;
}

/* Navigation Tabs */
.hetzner-tabs {
    margin-bottom: 25px;
}

.hetzner-tabs .nav-link {
    color: var(--hetzner-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.hetzner-tabs .nav-link:hover {
    color: var(--hetzner-primary);
    border-color: transparent;
    background: var(--hetzner-bg-light);
}

.hetzner-tabs .nav-link.active {
    color: var(--hetzner-primary);
    border-color: var(--hetzner-primary);
    background: transparent;
}

.hetzner-tabs .nav-link i {
    margin-right: 8px;
}

/* Cards */
.hetzner-card {
    background: #fff;
    border: 1px solid var(--hetzner-border);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.hetzner-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--hetzner-border);
    background: var(--hetzner-bg-light);
    border-radius: 8px 8px 0 0;
}

.hetzner-card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--hetzner-secondary);
}

.hetzner-card-header h5 i {
    margin-right: 10px;
    color: var(--hetzner-primary);
}

.hetzner-card-body {
    padding: 20px;
}

/* Buttons */
.btn-hetzner {
    background: var(--hetzner-primary);
    border-color: var(--hetzner-primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-hetzner:hover {
    background: var(--hetzner-primary-dark);
    border-color: var(--hetzner-primary-dark);
    color: #fff;
}

.btn-hetzner:focus,
.btn-hetzner:active {
    background: var(--hetzner-primary-dark);
    border-color: var(--hetzner-primary-dark);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(213, 12, 45, 0.25);
}

.btn-hetzner-outline {
    background: transparent;
    border: 2px solid var(--hetzner-primary);
    color: var(--hetzner-primary);
}

.btn-hetzner-outline:hover {
    background: var(--hetzner-primary);
    color: #fff;
}

/* Power Buttons */
.power-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.power-btn {
    min-width: 120px;
}

.power-btn.btn-success {
    background: var(--hetzner-success);
    border-color: var(--hetzner-success);
}

.power-btn.btn-danger {
    background: var(--hetzner-danger);
    border-color: var(--hetzner-danger);
}

.power-btn.btn-warning {
    background: var(--hetzner-warning);
    border-color: var(--hetzner-warning);
    color: #000;
}

/* Tables */
.hetzner-table {
    width: 100%;
    margin-bottom: 0;
}

.hetzner-table th {
    background: var(--hetzner-bg-light);
    font-weight: 600;
    color: var(--hetzner-secondary);
    padding: 12px 15px;
    border-bottom: 2px solid var(--hetzner-border);
    font-size: 13px;
    text-transform: uppercase;
}

.hetzner-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--hetzner-border);
    vertical-align: middle;
}

.hetzner-table tr:last-child td {
    border-bottom: none;
}

.hetzner-table tr:hover td {
    background: var(--hetzner-bg-light);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-grid-item {
    background: var(--hetzner-bg-light);
    padding: 15px;
    border-radius: 6px;
}

.info-grid-item .label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.info-grid-item .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--hetzner-secondary);
}

.info-grid-item .value.ip {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    background: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--hetzner-border);
    color: var(--hetzner-secondary);
    transition: all 0.2s ease;
    text-decoration: none;
}

.quick-action-btn:hover {
    background: var(--hetzner-bg-light);
    border-color: var(--hetzner-primary);
    color: var(--hetzner-primary);
    text-decoration: none;
}

.quick-action-btn i {
    font-size: 18px;
}

/* Bandwidth Usage */
.bandwidth-bar {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.bandwidth-bar .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--hetzner-primary) 0%, #ff6b6b 100%);
    transition: width 0.3s ease;
}

.bandwidth-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
}

/* Volume Cards */
.volume-card {
    border: 1px solid var(--hetzner-border);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fff;
}

.volume-card .volume-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 10px;
}

.volume-card .volume-info {
    font-size: 13px;
    color: #666;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.volume-card .volume-actions {
    margin-top: 15px;
    display: flex;
    gap: 8px;
}

/* Image Selector */
.image-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.image-option {
    border: 2px solid var(--hetzner-border);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-option:hover {
    border-color: var(--hetzner-primary);
}

.image-option.selected {
    border-color: var(--hetzner-primary);
    background: rgba(213, 12, 45, 0.05);
}

.image-option img {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
}

.image-option .name {
    font-weight: 500;
    font-size: 14px;
}

.image-option .version {
    font-size: 12px;
    color: #666;
}

/* Backup/Snapshot Cards */
.backup-card, .snapshot-card {
    background: #fff;
    border: 1px solid var(--hetzner-border);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.backup-card .backup-date,
.snapshot-card .snapshot-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.backup-card .backup-size,
.snapshot-card .snapshot-size {
    font-size: 13px;
    color: #666;
}

/* Console Container */
.console-container {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.console-container iframe {
    width: 100%;
    height: 600px;
    border: none;
}

.console-controls {
    background: var(--hetzner-secondary);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-controls .btn {
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
}

.console-controls .btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

.chart-period-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.chart-period-selector .btn {
    padding: 5px 15px;
    font-size: 13px;
}

/* Modals */
.hetzner-modal .modal-header {
    background: var(--hetzner-primary);
    color: #fff;
    border-radius: 0;
}

.hetzner-modal .modal-header .close {
    color: #fff;
    opacity: 0.8;
}

.hetzner-modal .modal-header .close:hover {
    opacity: 1;
}

.hetzner-modal .modal-title {
    font-weight: 600;
}

.hetzner-modal .modal-footer {
    background: var(--hetzner-bg-light);
}

/* Forms */
.hetzner-form .form-group {
    margin-bottom: 20px;
}

.hetzner-form label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--hetzner-secondary);
}

.hetzner-form .form-control {
    border-radius: 4px;
    border: 1px solid var(--hetzner-border);
    padding: 10px 15px;
}

.hetzner-form .form-control:focus {
    border-color: var(--hetzner-primary);
    box-shadow: 0 0 0 0.2rem rgba(213, 12, 45, 0.15);
}

.hetzner-form .form-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Rescue Mode Banner */
.rescue-mode-banner {
    background: linear-gradient(135deg, var(--hetzner-warning) 0%, #ffb800 100%);
    color: #000;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rescue-mode-banner i {
    font-size: 24px;
    margin-right: 15px;
}

.rescue-mode-banner .message {
    flex: 1;
}

.rescue-mode-banner .message strong {
    display: block;
    font-size: 16px;
}

.rescue-mode-banner .message span {
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .server-header {
        padding: 20px;
    }
    
    .server-header .server-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .hetzner-tabs .nav-link {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .hetzner-tabs .nav-link i {
        display: none;
    }
    
    .power-controls {
        flex-direction: column;
    }
    
    .power-btn {
        width: 100%;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    .hetzner-tabs,
    .power-controls,
    .quick-actions,
    .btn,
    .hetzner-loading {
        display: none !important;
    }
    
    .hetzner-card {
        box-shadow: none;
        border: 1px solid #000;
    }
}
