:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --text-primary: #333333;
    --text-secondary: #6c757d;
    --border-color: #e9ecef;
    --input-bg: #ffffff;
    --table-hover: #f8f9fa;
    --header-bg: linear-gradient(135deg, #d4001f 0%, #8b0013 100%);
    --totals-bg: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    --info-bg: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    --shadow: rgba(0,0,0,0.1);
    --project-bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

[data-theme="dark"] {
    --bg-primary: #2d2d2d;
    --bg-secondary: #1a1a1a;
    --bg-gradient: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    --input-bg: #21262d;
    --table-hover: #21262d;
    --header-bg: linear-gradient(135deg, #d4001f 0%, #8b0013 100%);
    --totals-bg: linear-gradient(135deg, rgba(212, 0, 31, 0.2) 0%, rgba(139, 0, 19, 0.2) 100%);
    --info-bg: linear-gradient(135deg, rgba(13, 110, 253, 0.2) 0%, rgba(13, 110, 253, 0.1) 100%);
    --shadow: rgba(0,0,0,0.3);
    --project-bg: linear-gradient(135deg, #30363d 0%, #21262d 100%);
}

#rbws-calculator-root {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    transition: all 0.3s ease;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px var(--shadow);
    overflow: hidden;
}

.rbws-calc-header {
    background: var(--header-bg);
    color: white;
    padding: 30px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rbws-calc-header-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.rbws-calc-logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.rbws-calc-logo-text {
    font-size: 2.2em;
    font-weight: 900;
    letter-spacing: 2px;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.rbws-calc-logo-icon {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    color: #d4001f;
    font-weight: bold;
}

.rbws-calc-header-text h1 {
    font-size: 2.5em;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.rbws-calc-header-text p {
    font-size: 1.1em;
    margin-top: 8px;
    opacity: 0.9;
    font-weight: 300;
}

.rbws-calc-user-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    text-align: center;
    min-width: 200px;
}

.rbws-calc-user-welcome {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
}

.rbws-calc-user-details {
    font-size: 14px;
    opacity: 0.9;
}

.rbws-calc-theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.rbws-calc-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.rbws-calc-content {
    padding: 40px;
}

.rbws-calc-main-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.rbws-calc-new-project-btn,
.rbws-calc-back-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white !important;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    text-decoration: none;
    display: inline-block;
}

.rbws-calc-back-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.rbws-calc-new-project-btn:hover,
.rbws-calc-back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.rbws-calc-back-btn:hover {
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.rbws-calc-project-section {
    margin-bottom: 50px;
    background: var(--project-bg);
    border-radius: 15px;
    padding: 30px;
    border: 2px solid var(--border-color);
    position: relative;
}

.rbws-calc-project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #d4001f;
}

.rbws-calc-project-title {
    font-size: 1.8em;
    font-weight: 600;
    color: var(--text-primary);
}

.rbws-calc-project-controls {
    display: flex;
    gap: 10px;
}

.rbws-calc-add-camera-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

.rbws-calc-delete-project-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(220, 53, 69, 0.3);
}

.rbws-calc-add-camera-btn:hover,
.rbws-calc-delete-project-btn:hover {
    transform: translateY(-1px);
}

.rbws-calc-camera-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow);
    table-layout: fixed;
}

.rbws-calc-camera-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    padding: 16px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    user-select: none;
}

.rbws-calc-camera-table th:not(:last-child) {
    border-right: 2px solid var(--border-color);
}

.rbws-calc-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
}

.rbws-calc-resizer:hover {
    background: #d4001f;
    opacity: 0.5;
}

.rbws-calc-resizing {
    cursor: col-resize;
}

.rbws-calc-resizing * {
    cursor: col-resize !important;
}

.rbws-calc-camera-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.rbws-calc-camera-table tr:hover {
    background: var(--table-hover);
}

.rbws-calc-camera-table input,
.rbws-calc-camera-table select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.rbws-calc-camera-table input:focus,
.rbws-calc-camera-table select:focus {
    outline: none;
    border-color: #d4001f;
    box-shadow: 0 0 0 3px rgba(212, 0, 31, 0.1);
}

.rbws-calc-camera-table input[type="number"] {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary) !important;
}

.rbws-calc-qty-input {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    text-align: center !important;
}

.rbws-calc-result-cell {
    background: var(--bg-secondary);
    font-weight: 600;
    color: #d4001f;
    text-align: center;
    font-size: 0.95em;
}

.rbws-calc-delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rbws-calc-delete-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

.rbws-calc-project-totals {
    background: var(--totals-bg);
    border: 2px solid #d4001f;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
}

.rbws-calc-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.rbws-calc-total-item {
    text-align: center;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow);
}

.rbws-calc-total-value {
    font-size: 2.2em;
    font-weight: 700;
    color: #d4001f;
    margin-bottom: 5px;
}

.rbws-calc-total-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rbws-calc-grand-totals {
    background: linear-gradient(135deg, #d4001f 0%, #8b0013 100%);
    color: white;
    border-radius: 15px;
    padding: 30px;
    margin-top: 40px;
    text-align: center;
}

.rbws-calc-grand-totals h2 {
    font-size: 2em;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.rbws-calc-grand-totals .rbws-calc-totals-grid {
    margin-top: 20px;
}

.rbws-calc-grand-totals .rbws-calc-total-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.rbws-calc-grand-totals .rbws-calc-total-value {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.rbws-calc-grand-totals .rbws-calc-total-label {
    color: rgba(255, 255, 255, 0.9);
}

.rbws-calc-save-load-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.rbws-calc-save-load-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    margin-right: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.rbws-calc-save-load-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.rbws-calc-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.rbws-calc-empty-state h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.rbws-calc-empty-state p {
    font-size: 1.1em;
    margin-bottom: 30px;
}

.rbws-calc-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .rbws-calc-camera-table {
        min-width: 1000px;
    }
}

@media (max-width: 768px) {
    .rbws-calc-content {
        padding: 20px;
    }
    
    .rbws-calc-camera-table {
        font-size: 0.9em;
    }
    
    .rbws-calc-camera-table th,
    .rbws-calc-camera-table td {
        padding: 8px 6px;
    }
    
    .rbws-calc-totals-grid {
        grid-template-columns: 1fr;
    }
    
    .rbws-calc-header-text h1 {
        font-size: 2em;
    }

    .rbws-calc-main-controls {
        flex-direction: column;
        align-items: center;
    }

    .rbws-calc-project-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .rbws-calc-header-content {
        flex-direction: column;
        gap: 15px;
    }

    .rbws-calc-logo-text {
        font-size: 1.5em;
    }
    
    .rbws-calc-user-info {
        min-width: auto;
        width: 100%;
    }
}