* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Navbar */
.navbar {
    background: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.navbar-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#currencySelector {
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    transition: all 0.3s ease;
    outline: none;
}

#currencySelector:hover {
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

#currencySelector:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -250px;
    right: -250px;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    bottom: -200px;
    left: -200px;
}

.login-box {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.login-subtitle {
    color: #666;
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

.login-box form {
    margin-bottom: 1.5rem;
}

.login-box .form-group {
    margin-bottom: 1.5rem;
}

.login-box .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
}

.login-box input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.login-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.password-toggle:hover {
    opacity: 1;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.login-footer p {
    color: #999;
    font-size: 0.85rem;
    margin: 0;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.container h1 {
    color: white;
    margin-bottom: 1.5rem;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.dashboard-header h1 {
    margin: 0;
}

.mobile-currency-wrapper {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.2);
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
}

.mobile-currency-wrapper select {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    color: #333;
    padding-right: 0.3rem;
}

.mobile-currency-wrapper select option {
    color: #333;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.3);
}

.tab-btn.active {
    background: white;
    color: #667eea;
}

.tab-content {
    display: none;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.tab-content.active {
    display: block;
}

/* Section */
.section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.section h2 {
    margin-bottom: 1.5rem;
    color: #667eea;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    color: #333;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 2px solid #667eea;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-align: left;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    color: #667eea;
}

.stat-value.green {
    color: #10b981;
}

.stat-comparison {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.stat-comparison.positive {
    color: #10b981;
}

.stat-comparison.negative {
    color: #ef4444;
}

.stat-comparison.neutral {
    color: #9ca3af;
}

/* Domains Grid */
.domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.domain-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    border-radius: 10px;
    color: white;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.domain-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.domain-card p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group.inline {
    display: inline-block;
    margin-right: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    table-layout: fixed;
}

.data-table thead {
    background: #667eea;
    color: white;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Revenue table specific column widths */
.revenue-table th:nth-child(1),
.revenue-table td:nth-child(1) { width: 12%; } /* Date */

.revenue-table th:nth-child(2),
.revenue-table td:nth-child(2) { width: 20%; } /* Domain */

.revenue-table th:nth-child(3),
.revenue-table td:nth-child(3) { width: 13%; } /* Impressions */

.revenue-table th:nth-child(4),
.revenue-table td:nth-child(4) { width: 10%; } /* Clicks */

.revenue-table th:nth-child(5),
.revenue-table td:nth-child(5) { width: 10%; } /* CTR */

.revenue-table th:nth-child(6),
.revenue-table td:nth-child(6) { width: 10%; } /* CPC */

.revenue-table th:nth-child(7),
.revenue-table td:nth-child(7) { width: 12%; } /* eCPM */

.revenue-table th:nth-child(8),
.revenue-table td:nth-child(8) { width: 13%; } /* Revenue */

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

.data-table .actions button {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    margin: 0;
    color: #667eea;
}

.close {
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

/* Messages */
.error-message {
    color: #dc3545;
    margin-top: 1rem;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: #28a745;
    margin-top: 1rem;
    display: none;
}

.success-message.show {
    display: block;
}

/* Status Badge */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.pending {
    background: #ffc107;
    color: #000;
}

.status-badge.paid {
    background: #28a745;
    color: white;
}

.status-badge.cancelled {
    background: #dc3545;
    color: white;
}

/* Payment Month Sections */
.payment-month-section {
    margin-bottom: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.payment-month-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.payment-month-header:hover {
    background: linear-gradient(135deg, #5568d3 0%, #65398b 100%);
}

.payment-month-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
}

.month-summary {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    display: block;
    margin-top: 0.25rem;
}

.toggle-icon {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.payment-month-content {
    padding: 0;
    transition: all 0.3s ease;
}

.payment-month-content table {
    margin: 0;
    border: none;
}

/* Responsive */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .navbar-menu {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .navbar-menu #username,
    .navbar-menu #adminUsername {
        display: none;
    }

    #currencySelector {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    /* Container */
    .container {
        padding: 1rem;
    }

    .container h1 {
        font-size: 1.5rem;
    }

    /* Dashboard Header Mobile */
    .dashboard-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .dashboard-header h1 {
        font-size: 1.3rem;
    }

    .mobile-currency-wrapper {
        display: flex;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Section */
    .section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .section h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    /* Tabs */
    .tabs {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Section Header */
    .section-header {
        gap: 1rem;
        align-items: flex-start;
    }

    /* Table */
    .data-table {
        font-size: 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.3rem;
        min-width: 60px;
    }

    /* Disable sorting on mobile */
    .data-table th {
        cursor: default !important;
        pointer-events: none;
    }

    .data-table th span {
        display: none;
    }

    /* Revenue Table: Hide columns on mobile - Show only Date, Impressions, eCPM, Revenue */
    /* Hide Domain */
    .revenue-table th:nth-child(2),
    .revenue-table td:nth-child(2),
    .revenue-table .hide-on-mobile:nth-child(2) {
        display: none;
    }
    
    /* Hide Clicks */
    .revenue-table th:nth-child(4),
    .revenue-table td:nth-child(4),
    .revenue-table .hide-on-mobile:nth-child(4) {
        display: none;
    }
    
    /* Hide CTR */
    .revenue-table th:nth-child(5),
    .revenue-table td:nth-child(5),
    .revenue-table .hide-on-mobile:nth-child(5) {
        display: none;
    }
    
    /* Hide CPC */
    .revenue-table th:nth-child(6),
    .revenue-table td:nth-child(6),
    .revenue-table .hide-on-mobile:nth-child(6) {
        display: none;
    }

    /* Status Badge - Mobile */
    .status-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
        white-space: nowrap;
    }

    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Form Groups */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 1rem;
    }

    /* Filters */
    .filters {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filters .form-group {
        width: 100%;
    }

    .filters .form-group.inline {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .filters select,
    .filters input {
        width: 100%;
    }

    /* Pagination */
    .pagination {
        font-size: 0.85rem;
    }

    .pagination button {
        padding: 0.4rem 0.7rem !important;
        font-size: 0.85rem !important;
    }

    /* Domains Grid */
    .domains-grid {
        grid-template-columns: 1fr;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        margin: 1rem auto;
        padding: 1rem;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .navbar-brand {
        font-size: 1rem;
    }

    .container h1 {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .data-table {
        font-size: 0.7rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.4rem 0.2rem;
        min-width: 50px;
    }

    /* Status Badge - Small Mobile */
    .status-badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.65rem;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .pagination button {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem !important;
    }

    .section h2 {
        font-size: 1.1rem;
    }

    /* Login Button - Mobile Override */
    .btn-login {
        padding: 1rem !important;
        font-size: 1.1rem !important;
        font-weight: 600 !important;
    }
}

/* Currency Selector with Flag Icons */
.currency-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

#currencyFlag {
    width: 1.5rem;
    height: 1rem;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Ranking Button Styles */
.btn-ranking {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.4);
}

.btn-ranking:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.5);
    background: linear-gradient(135deg, #FFE03D 0%, #FFB347 100%);
}

@media (max-width: 768px) {
    .btn-ranking {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Mobile Footer Menu */
.mobile-footer-menu {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

.mobile-footer-menu ul {
    display: flex;
    justify-content: space-around;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-footer-menu li {
    flex: 1;
}

.mobile-footer-menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: #999;
    font-size: 0.7rem;
    padding: 0.5rem;
    transition: color 0.2s ease;
}

.mobile-footer-menu a.active {
    color: #667eea;
}

.mobile-footer-menu a:hover {
    color: #667eea;
}

.mobile-footer-menu .menu-icon {
    font-size: 1.3rem;
}

.mobile-footer-menu .menu-label {
    font-weight: 500;
}

/* Mobile: Hide navbar, show footer */
@media (max-width: 768px) {
    .navbar {
        display: none;
    }

    .mobile-footer-menu {
        display: block;
    }

    body {
        padding-bottom: 70px;
    }

    .back-link {
        display: none;
    }
}
