/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-green: #22c55e;
    --dark-green: #16a34a;
    --darker-green: #15803d;
    --dark-bg: #1f2937;
    --darker-bg: #111827;
    --card-bg: #374151;
    --text-light: #f3f4f6;
    --text-gray: #9ca3af;
    --border-color: #4b5563;
    --red: #ef4444;
    --yellow: #eab308;
}

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

/* Layout Principal */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary-green) 0%, var(--dark-green) 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.sidebar-logo img {
    width: 100%;
    max-width: 140px;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 30px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-green);
    font-weight: bold;
    font-size: 20px;
}

.user-info {
    flex: 1;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 14px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Sidebar Version */
.sidebar-version {
    margin-top: auto;
    padding: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
    background-color: var(--darker-bg);
    min-height: 100vh;
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-light);
}

.page-subtitle {
    color: var(--text-gray);
    font-size: 16px;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-light);
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-gray);
}

.card-large {
    grid-column: span 2;
}

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

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

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

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: var(--primary-green);
    color: white;
}

.badge-gray {
    background: var(--card-bg);
    color: var(--text-light);
}

.badge-active {
    background: var(--primary-green);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
    font-weight: 600;
    font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 14px;
    transition: all 0.3s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

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

.form-help {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 6px;
}

/* Instance Card */
.instance-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.instance-name {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-light);
}

.instance-id {
    color: var(--text-gray);
    font-size: 14px;
    margin-left: 10px;
}

.instance-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.instance-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.info-label {
    color: var(--text-gray);
}

.info-value {
    color: var(--text-light);
    font-family: monospace;
}

/* Plans Grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.plan-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.plan-card:hover {
    border-color: var(--primary-green);
    transform: translateY(-5px);
}

.plan-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.plan-price {
    font-size: 18px;
    color: var(--primary-green);
    margin-bottom: 15px;
}

.plan-description {
    color: var(--text-gray);
    margin-bottom: 20px;
    font-size: 14px;
}

/* Back Button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.back-button:hover {
    color: var(--primary-green);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-10 {
    gap: 10px;
}

/* Notifications */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-success {
    background: var(--primary-green);
    color: white;
}

.notification-error {
    background: var(--red);
    color: white;
}

.notification-info {
    background: #3b82f6;
    color: white;
}

/* Logo styling */
.sidebar-logo i {
    font-size: 32px;
    color: white;
}

/* Copy button inline */
.btn-inline {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    margin-left: 8px;
    vertical-align: middle;
}

/* File input styling */
input[type="file"] {
    padding: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--primary-green);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 10px;
    font-weight: 600;
}

input[type="file"]::file-selector-button:hover {
    background: var(--dark-green);
}

/* Time input styling */
input[type="time"],
input[type="datetime-local"] {
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 14px;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

table th {
    text-align: left;
    padding: 12px;
    color: var(--text-gray);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 12px;
    color: var(--text-light);
    font-size: 14px;
}

table tbody tr {
    transition: background 0.2s;
}

table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

table tbody tr:last-child {
    border-bottom: none;
}

/* Admin specific */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 8px;
    width: 45px;
    height: 45px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    background: var(--dark-green);
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

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

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        z-index: 1002; /* Acima do overlay no mobile */
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px 15px;
        padding-top: 70px; /* Espaço para o botão hambúrguer */
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .card-large {
        grid-column: span 1;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .page-subtitle {
        font-size: 14px;
    }
}
