/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1d1d1f;
}

/* Login Screen */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.login-form {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-form h2 {
    margin-bottom: 30px;
    color: #1d1d1f;
    font-size: 28px;
}

.login-form input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #0071e3;
}

.caps-warning {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Navigation */
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0 20px;
}

.nav-menu {
    display: flex;
    list-style: none;
    max-width: 1200px;
    margin: 0 auto;
    height: 60px;
}

.nav-item {
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    text-decoration: none;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: #0071e3;
    border-bottom-color: #0071e3;
    background: rgba(0, 113, 227, 0.05);
}

.nav-link i {
    margin-right: 8px;
    font-size: 16px;
}

.logout-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff3b30;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #d70015;
}

/* Page Content */
.page-content {
    margin-top: 60px;
    padding: 40px 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.tab-page {
    display: none;
}

.tab-page.active {
    display: block;
}

/* Forms */
.config-form {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.config-form h2 {
    margin-bottom: 25px;
    color: #1d1d1f;
    font-size: 24px;
    display: flex;
    align-items: center;
}

.config-form h2 i {
    margin-right: 12px;
    color: #0071e3;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1d1d1f;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0071e3;
}

/* Buttons */
.btn-primary {
    background: #0071e3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #005bb5;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ff3b30;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-danger:hover {
    background: #d70015;
}

.btn-edit {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-edit:hover {
    background: #1e7e34;
}

/* Tag Input */
.tag-input-container {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 8px;
    min-height: 50px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.domain-tag {
    background: #0071e3;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.domain-tag .domain-action {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.domain-tag .domain-action:hover {
    opacity: 1;
}

#domainInput {
    border: none;
    outline: none;
    flex: 1;
    min-width: 200px;
    padding: 8px;
}

/* Config List */
.config-list {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.config-item {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: box-shadow 0.3s;
}

.config-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.config-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.config-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.domains-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.config-info {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.config-info div {
    margin-bottom: 5px;
}

/* Template List */
.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f5f5f7;
    border-radius: 10px;
    margin-bottom: 12px;
}

.template-name {
    font-weight: 600;
    color: #1d1d1f;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-confirm {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

/* GitHub Popup */
.github-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.github-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
}

.popup-header h3 {
    margin: 0;
    color: #1d1d1f;
}

.popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.popup-body {
    padding: 30px;
}

.popup-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.cloudflare-section {
    margin-bottom: 20px;
}

.cloudflare-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1d1d1f;
}

.cloudflare-section input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
}

.cloudflare-section small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.status-info {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}

/* Notifications */
#notification-area {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10001;
}

.notification {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
    border-left: 4px solid #28a745;
    animation: slideIn 0.3s ease-out;
}

.notification.error {
    border-left-color: #ff3b30;
}

.notification.warning {
    border-left-color: #ffc107;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        height: auto;
    }
    
    .nav-item {
        flex: none;
    }
    
    .nav-link {
        height: 50px;
        border-bottom: 1px solid #e0e0e0;
        border-right: none;
    }
    
    .logout-btn {
        position: static;
        transform: none;
        margin: 10px auto;
        display: block;
    }
    
    .page-content {
        margin-top: 200px;
        padding: 20px 10px;
    }
    
    .config-form,
    .config-list {
        padding: 20px;
    }
    
    .modal-content,
    .github-popup-content {
        width: 95%;
        margin: 20px;
    }
}
