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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #f5f5f7;
    min-height: 100vh;
}

/* Login/Logout Pages */
.login-page,
.logout-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #A7C2E4 0%, #6B9BD1 100%);
}

.login-container,
.logout-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box,
.logout-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.4s ease-out;
}

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

.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo,
.logout-logo,
.header-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
}

.header-logo {
    width: 48px;
    height: 48px;
}

.login-title,
.logout-title {
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 30px;
    color: #1d1d1f;
}

.logout-message {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.logout-link {
    display: block;
    text-align: center;
    color: #007AFF;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.logout-link:hover {
    color: #0051D5;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    background: #fff;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-input[readonly] {
    background: #f5f5f7;
    color: #999;
    cursor: not-allowed;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
	min-width: 400px;
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #999;
}

.form-display {
    padding: 12px 16px;
    background: #f5f5f7;
    border-radius: 10px;
    color: #666;
}

/* Buttons */
.login-button,
.btn-save {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.login-button:hover,
.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 122, 255, 0.3);
}

.login-button:active,
.btn-save:active {
    transform: translateY(0);
}

.btn-cancel {
    display: inline-block;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    background: #f5f5f7;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #e8e8ed;
}

/* Error Messages */
.error-message {
    background: #fee;
    color: #c00;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: shake 0.3s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.success-message {
    background: #e6f7e6;
    color: #00a000;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 20px;
    font-size: 14px;
    animation: fadeIn 0.3s ease-out;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.main-header {
    background: white;
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-title {
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
}

.logout-button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: #f5f5f7;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
}

.logout-button:hover {
    background: #e8e8ed;
    color: #333;
}

/* Tabs */
.tabs-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
}

.tabs {
    display: flex;
    border-bottom: 1px solid #e5e5ea;
    padding: 0 20px;
}

.tab-button {
    flex: 0 0 auto;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.tab-button:hover {
    color: #333;
}

.tab-button.active {
    color: #007AFF;
    border-bottom-color: #007AFF;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 20px;
    min-height: 500px;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    animation: fadeIn 0.3s ease-out;
}

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

/* Controls Bar */
.controls-bar {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

/* Search Group - contains search box and count */
.search-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* License Count Display */
.license-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

/* Add Button - pushed to right */
.add-button {
    margin-left: auto;
}

/* Upload Form - pushed to right */
.upload-form {
    margin-left: auto;
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box {
    width: 300px;
    padding: 10px 16px;
    font-size: 14px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    transition: all 0.2s;
}

.search-box:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: #007AFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-button:hover {
    background: #0051D5;
}

.clear-search {
    font-size: 14px;
    color: #999;
    text-decoration: none;
    transition: color 0.2s;
}

.clear-search:hover {
    color: #666;
}

.add-button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: #007AFF;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.add-button:hover {
    background: #0051D5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* List Container */
.list-container {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    background: #fafafa;
}

.list-container::-webkit-scrollbar {
    width: 8px;
}

.list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.list-container::-webkit-scrollbar-thumb {
    background: #c1c1c6;
    border-radius: 10px;
}

.list-container::-webkit-scrollbar-thumb:hover {
    background: #8e8e93;
}

/* List Header */
.list-header {
    display: grid;
    grid-template-columns: 1fr 120px 130px 110px 120px;
    gap: 12px;
    padding: 12px 20px;
    background: #f5f5f7;
    border-bottom: 2px solid #e5e5ea;
    position: sticky;
    top: 0;
    z-index: 10;
}

.list-header-col {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Set All Link in Header */
.set-all-link {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #007AFF;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 2px;
    text-decoration: none;
    transition: color 0.2s;
}

.set-all-link:hover {
    color: #0051D5;
    text-decoration: underline;
}

/* List Items */
.list-item {
    display: grid;
    grid-template-columns: 1fr 120px 130px 110px 120px;
    gap: 12px;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e5e5ea;
    transition: all 0.2s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: #f5f5f7;
}

.list-item.disabled {
    opacity: 0.5;
}

.list-item.disabled .list-item-name {
    color: #999;
}

.list-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.list-item-name {
    font-size: 15px;
    font-weight: 500;
    color: #1d1d1f;
}

.list-item-data {
    font-size: 14px;
    color: #666;
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

/* Versions List Grid */
.list-header-versions {
    grid-template-columns: 1fr 110px;
}

.list-item-versions {
    display: grid;
    grid-template-columns: 1fr 110px;
}

/* Files List Grid */
.list-header-files {
    grid-template-columns: 1fr 100px 120px;
}

.list-item-files {
    display: grid;
    grid-template-columns: 1fr 100px 120px;
}

.icon-button {
    width: 36px;
    height: 36px;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background: #e5e5ea;
}

.icon-button img {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.icon-button:hover img {
    opacity: 1;
}

.icon-button-disabled {
    cursor: default;
    opacity: 0.35;
}

.icon-button-disabled:hover {
    background: transparent;
}

.icon-button-disabled:hover img {
    opacity: 0.35;
}

.inline-form {
    display: inline;
}

/* Badges */
.invalid-badge,
.disabled-badge {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.invalid-badge {
    background: #fee;
    color: #c00;
}

.disabled-badge {
    background: #f5f5f7;
    color: #999;
}

/* No Items */
.no-items {
    padding: 60px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Panel */
.modal-panel {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 24px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-save {
    width: auto;
    min-width: 100px;
}

/* Number Input */
.number-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.number-input .form-input {
    width: 120px;
}

.number-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #d2d2d7;
    background: white;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn:hover {
    background: #f5f5f7;
    border-color: #007AFF;
}

.number-btn:active {
    background: #e5e5ea;
}

/* Checkbox */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    cursor: pointer;
}

/* Message Animations */
.message {
    margin: 20px;
    padding: 12px 20px;
    border-radius: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .main-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-left {
        flex-direction: column;
    }
    
    .search-box {
        width: 200px;
    }
    
    .controls-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .modal-panel {
        width: 95%;
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    .modal-overlay,
    .logout-button,
    .add-button,
    .icon-button,
    .controls-bar {
        display: none !important;
    }
}

/* Focus Visible for Accessibility */
*:focus-visible {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Clear Button */
.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: #c1c1c6;
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.search-clear:hover {
    background: #8e8e93;
}

.search-clear:active {
    background: #636366;
    transform: translateY(-50%) scale(0.9);
}

.search-clear svg {
    display: block;
    width: 10px;
    height: 10px;
}

/* Search Wrapper */
.search-wrapper {
    position: relative;
    display: inline-block;
}

/* Adjust search box padding to make room for clear button */
.search-wrapper .search-box {
    padding-right: 36px;
}

/* File List Specific Styles */
.file-icon {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    margin-right: 12px;
}

.file-size {
    color: #999;
    font-size: 14px;
}

/* Upload Form and Button */
.upload-form {
    display: inline-block;
}

.file-input {
    display: none;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: #007AFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-button:hover {
    background: #0051D5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.upload-icon {
    width: 16px;
    height: 16px;
    filter: invert(1);
}

/* Small Modal Panel for Rename */
.modal-panel-small {
    max-width: 400px;
}

/* File List Item Hover Effect */
#files-list .list-item:hover {
    background: #f5f5f7;
}

/* Responsive adjustments for file tab */
@media (max-width: 768px) {
    .upload-button {
        padding: 10px 16px;
        font-size: 13px;
    }

    .file-icon {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }
}

/* Warning Tooltip */
.warning-icon {
    position: relative;
    cursor: default;
}

.warning-tooltip {
    position: fixed;
    padding: 8px 12px;
    background: #333;
    color: white;
    font-size: 13px;
    line-height: 1.4;
    border-radius: 6px;
    white-space: normal;
    max-width: 250px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.warning-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

/* Target Version Dropdown */
.target-form {
    display: inline;
    margin: 0;
}

.target-select {
    padding: 6px 12px;
    font-size: 14px;
    color: #333;
    background: white;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.target-select:hover {
    border-color: #007AFF;
    background-color: #fafafa;
}

.target-select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.target-select option:disabled {
    color: #999;
    font-style: italic;
}

.target-select.target-disabled {
    color: #999;
    background-color: #fef5f5;
    border-color: #e8b4b4;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    color: #333;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    pointer-events: auto;
    border-left: 4px solid #007AFF;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    border-left-color: #34C759;
}

.toast.error {
    border-left-color: #FF3B30;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon::before {
    content: '✓';
    color: #34C759;
}

.toast.error .toast-icon::before {
    content: '✕';
    color: #FF3B30;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

/* Set All Button */
.set-all-button {
    display: block;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 500;
    color: white;
    background: #007AFF;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 2px;
}

.set-all-button:hover {
    background: #0051D5;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}