/* ============================================
   TICKET AUTOMATION PRO - PROFESSIONAL STYLES
   ============================================ */

:root {
    --primary-color: #f1c40f;
    --primary-dark: #f39c12;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --light-bg: #1a1a1a;
    --border-color: #333;
    --text-primary: #fff;
    --text-secondary: #ccc;
    --text-light: #999;
    --body-bg: #121212;
    --card-bg: #1e1e1e;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.7);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--body-bg);
    min-height: 100vh;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

/* ====== CONTAINER LAYOUT ====== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-container {
    flex: 1;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    gap: 20px;
    padding: 20px;
}

.sidebar {
    width: 280px;
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.sidebar-header h3 {
    font-size: 1.3em;
    margin-bottom: 5px;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
}

.sidebar-nav li {
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
}

.sidebar-nav span {
    margin-right: 10px;
    font-size: 1.3em;
}

.content-area {
    flex: 1;
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        flex-direction: row;
        max-height: 80px;
    }

    .sidebar-nav {
        display: flex;
        flex: 1;
    }

    .sidebar-nav li {
        border-right: 1px solid var(--border-color);
        border-bottom: none;
        flex: 1;
    }

    .content-area {
        padding: 30px 20px;
    }
}

/* ====== HEADER ====== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 30px 40px;
    box-shadow: var(--shadow-md);
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 1em;
}

.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 20px;
}

.automation-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-active {
    background: #27ae60;
    animation: pulse 2s infinite;
}

.status-inactive {
    background: #e74c3c;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ====== FORMS ====== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: var(--transition);
    background: var(--card-bg);
    color: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ====== BUTTONS ====== */
button,
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

button:active,
.btn:active {
    transform: translateY(0);
}

button:disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #999 0%, #777 100%);
    box-shadow: 0 4px 15px rgba(153, 153, 153, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #229954 100%);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
}

/* ====== CARDS ====== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 2px solid var(--border-color);
    margin: -20px -20px 20px -20px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.card-body {
    padding: 0;
}

.card-footer {
    border-top: 1px solid var(--border-color);
    margin: 20px -20px -20px -20px;
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ====== SECTIONS ====== */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.8em;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-subtitle {
    font-size: 1.2em;
    color: var(--text-primary);
    margin: 25px 0 15px 0;
    font-weight: 600;
}

/* ====== GRID & LAYOUT ====== */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.flex {
    display: flex;
    gap: 15px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* ====== TABLES ====== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--light-bg);
}

/* ====== ALERTS & MESSAGES ====== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: var(--info-color);
    color: #0c5460;
}

/* ====== MODALS ====== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8em;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ====== LISTS ====== */
.list {
    list-style: none;
}

.list-item {
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.list-item:hover {
    background: #e8e8ff;
    box-shadow: var(--shadow-sm);
}

/* ====== BADGES ====== */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-right: 5px;
}

.badge-primary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    color: var(--primary-color);
}

.badge-success {
    background: rgba(39, 174, 96, 0.2);
    color: var(--success-color);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning-color);
}

/* ====== LOADING & PROGRESS ====== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    width: 0%;
    transition: width 0.3s ease;
}

/* ====== PAGINATION ====== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

.pagination a:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-color);
}

.pagination .active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-color);
}

/* ====== UTILITIES ====== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-light { color: var(--text-light); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 40px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

.hidden { display: none; }
.visible { display: block; }

/* ====== RESPONSIVE DESIGN FOR MOBILE ====== */
@media (max-width: 768px) {
    .app-wrapper {
        padding: 10px;
    }

    header {
        padding: 20px;
        text-align: center;
    }

    header h1 {
        font-size: 1.5em;
    }

    .main-container {
        padding: 10px;
        gap: 15px;
    }

    .sidebar {
        width: 100%;
        padding: 15px;
        max-height: none;
        position: static;
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .sidebar-nav li {
        border: none;
        flex: 1;
        min-width: calc(50% - 5px);
    }

    .sidebar-nav a {
        padding: 12px 8px;
        text-align: center;
        font-size: 0.85em;
    }

    .sidebar-nav span {
        margin-right: 5px;
        font-size: 1.1em;
    }

    .content-area {
        padding: 20px;
    }

    .section-title {
        font-size: 1.4em;
        flex-direction: column;
        gap: 5px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .card {
        margin-bottom: 15px;
    }

    .card-body, .card-footer {
        padding: 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-group {
        width: 100%;
    }

    .btn {
        width: 100%;
        margin-bottom: 5px;
    }

    .flex {
        flex-direction: column;
    }

    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    table {
        font-size: 0.85em;
    }

    th, td {
        padding: 8px 5px;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
    }

    .zone-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .map-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3em;
    }

    .content-area {
        padding: 15px;
    }

    .sidebar-nav li {
        min-width: calc(33.333% - 5px);
    }

    .section-title {
        font-size: 1.2em;
    }

    .card-title {
        font-size: 1.1em;
    }

    .badge {
        font-size: 0.75em;
        padding: 3px 6px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .form-group label {
        font-size: 0.9em;
    }

    .form-group input, .form-group select {
        font-size: 16px; /* Previene zoom su iOS */
    }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 12px 16px;
    }

    .sidebar-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .zone-marker {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}

/* Animations for mobile */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====== FOOTER ====== */
footer {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

footer p {
    margin: 0;
    opacity: 0.9;
}

/* ====== CUSTOM SCROLLBAR ====== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ====== AUTOCOMPLETE ====== */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    display: none;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.slide-in-right {
    animation: slideInRight 0.3s ease;
}
